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