Change App.xaml to resolve packaging issues for server.

This commit is contained in:
Burak Kaan Köse
2024-07-19 20:30:50 +02:00
parent 7d0934b679
commit 026151e7e4
5 changed files with 20 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ namespace Wino.Server
var context = new DispatcherQueueSynchronizationContext( var context = new DispatcherQueueSynchronizationContext(
DispatcherQueue.GetForCurrentThread()); DispatcherQueue.GetForCurrentThread());
SynchronizationContext.SetSynchronizationContext(context); SynchronizationContext.SetSynchronizationContext(context);
new App(); new ServerApp();
}); });
} }
} }

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Application <Application
x:Class="Wino.Server.NET8.App" x:Class="Wino.Server.NET8.ServerApp"
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:Wino.Server.NET8" xmlns:local="using:Wino.Server.NET8"

View File

@@ -13,16 +13,16 @@ using Wino.Services;
namespace Wino.Server.NET8 namespace Wino.Server.NET8
{ {
public partial class App : Application public partial class ServerApp : Application
{ {
public new static App Current => (App)Application.Current; public new static ServerApp Current => (ServerApp)Application.Current;
private const string WinoServerAppName = "Wino.Server"; private const string WinoServerAppName = "Wino.Server";
public TaskbarIcon TrayIcon { get; private set; } public TaskbarIcon TrayIcon { get; private set; }
public bool HandleClosedEvents { get; set; } = true; public bool HandleClosedEvents { get; set; } = true;
public IServiceProvider Services { get; private set; } public IServiceProvider Services { get; private set; }
public App() public ServerApp()
{ {
InitializeComponent(); InitializeComponent();
} }

View File

@@ -108,13 +108,13 @@ namespace Wino.Server
public async Task TestOutlookSynchronizer() public async Task TestOutlookSynchronizer()
{ {
var accountService = App.Current.Services.GetService<IAccountService>(); var accountService = ServerApp.Current.Services.GetService<IAccountService>();
var accs = await accountService.GetAccountsAsync(); var accs = await accountService.GetAccountsAsync();
var acc = accs.ElementAt(0); var acc = accs.ElementAt(0);
var authenticator = App.Current.Services.GetService<OutlookAuthenticator>(); var authenticator = ServerApp.Current.Services.GetService<OutlookAuthenticator>();
var processor = App.Current.Services.GetService<IOutlookChangeProcessor>(); var processor = ServerApp.Current.Services.GetService<IOutlookChangeProcessor>();
var sync = new OutlookSynchronizer(acc, authenticator, processor); var sync = new OutlookSynchronizer(acc, authenticator, processor);

View File

@@ -1,18 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Wino.Server</RootNamespace> <RootNamespace>Wino.Server</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms> <Platforms>x86;x64;ARM64</Platforms>
<SelfContained>true</SelfContained> <RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers> <RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers> <WindowsSdkPackageVersion>10.0.19041.35-preview</WindowsSdkPackageVersion>
<PublishProfile>win-$(Platform).pubxml</PublishProfile> <PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI> <UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling> <EnableMsixTooling>true</EnableMsixTooling>
<DisableEmbeddedXbf>false</DisableEmbeddedXbf>
<SupportedOSPlatformVersion>10.0.22621.0</SupportedOSPlatformVersion>
</PropertyGroup> </PropertyGroup>
<!-- Disable XAML generated main to enable single activation. --> <!-- Disable XAML generated main to enable single activation. -->
@@ -36,13 +40,15 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ApplicationDefinition Include="ServerApp.xaml" SubType="Designer" />
<None Remove="app.manifest" /> <None Remove="app.manifest" />
<None Remove="Assets\Wino_Icon.ico" /> <None Remove="Assets\Wino_Icon.ico" />
<None Remove="TrayIconResources.xaml" /> <None Remove="TrayIconResources.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Remove="App.xaml" /> <None Remove="ServerApp.xaml" />
<Page Remove="ServerApp.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>