Вставил SimpleInjector, откатил минимальную версию обратно.
This commit is contained in:
parent
ee0ae659f2
commit
8eab046abe
6 changed files with 63 additions and 29 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
<DefaultLanguage>ru-RU</DefaultLanguage>
|
<DefaultLanguage>ru-RU</DefaultLanguage>
|
||||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
|
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
|
||||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
|
||||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,6 @@ namespace Intersvyaz.Net
|
||||||
new ProductInfoHeaderValue("(+https://github.com/synzr/intersvyaz)"));
|
new ProductInfoHeaderValue("(+https://github.com/synzr/intersvyaz)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntersvyazClient(string token) : base()
|
|
||||||
{
|
|
||||||
_httpClient.DefaultRequestHeaders.Authorization
|
|
||||||
= new AuthenticationHeaderValue("Bearer", token);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вход в систему.
|
/// Вход в систему.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,10 @@ using Windows.UI.Xaml.Data;
|
||||||
using Windows.UI.Xaml.Input;
|
using Windows.UI.Xaml.Input;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
using Intersvyaz.Pages;
|
using SimpleInjector;
|
||||||
|
using Intersvyaz.Views;
|
||||||
|
using Intersvyaz.Net;
|
||||||
|
using Intersvyaz.Core.Services;
|
||||||
|
|
||||||
namespace Intersvyaz
|
namespace Intersvyaz
|
||||||
{
|
{
|
||||||
|
|
@ -23,14 +26,25 @@ namespace Intersvyaz
|
||||||
/// </summary>
|
/// </summary>
|
||||||
sealed partial class App : Application
|
sealed partial class App : Application
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Текущее приложение.
|
||||||
|
/// </summary>
|
||||||
|
public static new App Current = (App)Application.Current;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Провайдер сервисов.
|
||||||
|
/// </summary>
|
||||||
|
public Container Services { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Инициализирует одноэлементный объект приложения. Это первая выполняемая строка разрабатываемого
|
/// Инициализирует одноэлементный объект приложения. Это первая выполняемая строка разрабатываемого
|
||||||
/// кода; поэтому она является логическим эквивалентом main() или WinMain().
|
/// кода; поэтому она является логическим эквивалентом main() или WinMain().
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
this.Suspending += OnSuspending;
|
Services = BuildServices();
|
||||||
|
Suspending += OnSuspending;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -67,7 +81,7 @@ namespace Intersvyaz
|
||||||
// Если стек навигации не восстанавливается для перехода к первой странице,
|
// Если стек навигации не восстанавливается для перехода к первой странице,
|
||||||
// настройка новой страницы путем передачи необходимой информации в качестве параметра
|
// настройка новой страницы путем передачи необходимой информации в качестве параметра
|
||||||
// параметр
|
// параметр
|
||||||
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
rootFrame.Navigate(typeof(LoginPage), e.Arguments);
|
||||||
}
|
}
|
||||||
// Обеспечение активности текущего окна
|
// Обеспечение активности текущего окна
|
||||||
Window.Current.Activate();
|
Window.Current.Activate();
|
||||||
|
|
@ -97,5 +111,17 @@ namespace Intersvyaz
|
||||||
//TODO: Сохранить состояние приложения и остановить все фоновые операции
|
//TODO: Сохранить состояние приложения и остановить все фоновые операции
|
||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создать контейнер сервисов.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Контейнер сервисов.</returns>
|
||||||
|
private static Container BuildServices()
|
||||||
|
{
|
||||||
|
var container = new Container();
|
||||||
|
container.Register<IntersvyazClient>(Lifestyle.Singleton);
|
||||||
|
container.Register<ISessionService, SessionService>(Lifestyle.Transient);
|
||||||
|
return container;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<DefaultLanguage>ru-RU</DefaultLanguage>
|
<DefaultLanguage>ru-RU</DefaultLanguage>
|
||||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
|
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
|
||||||
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
|
||||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
|
@ -119,10 +119,10 @@
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Pages\MainPage.xaml.cs">
|
|
||||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Views\LoginPage.xaml.cs">
|
||||||
|
<DependentUpon>LoginPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AppxManifest Include="Package.appxmanifest">
|
<AppxManifest Include="Package.appxmanifest">
|
||||||
|
|
@ -145,22 +145,32 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Page Include="Pages\MainPage.xaml">
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Page>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||||
<Version>6.2.8</Version>
|
<Version>6.2.8</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="SimpleInjector">
|
||||||
|
<Version>5.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Intersvyaz.Core\Intersvyaz.Core.csproj">
|
<ProjectReference Include="..\Intersvyaz.Core\Intersvyaz.Core.csproj">
|
||||||
<Project>{fbe4ced9-3007-44b4-aabb-e49916da09c1}</Project>
|
<Project>{fbe4ced9-3007-44b4-aabb-e49916da09c1}</Project>
|
||||||
<Name>Intersvyaz.Core</Name>
|
<Name>Intersvyaz.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Intersvyaz.Net\Intersvyaz.Net.csproj">
|
||||||
|
<Project>{d53e9b31-82ca-4b3b-a6ba-9f4b9353abb1}</Project>
|
||||||
|
<Name>Intersvyaz.Net</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="Views\LoginPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
<Page
|
<Page
|
||||||
x:Class="Intersvyaz.Pages.MainPage"
|
x:Class="Intersvyaz.Views.LoginPage"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:Intersvyaz.Pages"
|
xmlns:local="using:Intersvyaz.Views"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<TextBlock Text="LoginPage" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
@ -12,19 +12,23 @@ using Windows.UI.Xaml.Data;
|
||||||
using Windows.UI.Xaml.Input;
|
using Windows.UI.Xaml.Input;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
|
using Intersvyaz.Core.Services;
|
||||||
|
|
||||||
// Документацию по шаблону элемента "Пустая страница" см. по адресу https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x419
|
namespace Intersvyaz.Views
|
||||||
|
|
||||||
namespace Intersvyaz
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Пустая страница, которую можно использовать саму по себе или для перехода внутри фрейма.
|
/// Страница входа.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class MainPage : Page
|
public sealed partial class LoginPage : Page
|
||||||
{
|
{
|
||||||
public MainPage()
|
private readonly ISessionService _sessionService;
|
||||||
|
|
||||||
|
public LoginPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// NOTE: Получение сервисов
|
||||||
|
_sessionService = App.Current.Services.GetInstance<ISessionService>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue