From 6f4e6943228b10d3a7d81d83f532054ef1451a81 Mon Sep 17 00:00:00 2001 From: Nick Randolph Date: Sun, 7 Jan 2024 02:18:27 +1100 Subject: [PATCH] feat: Adding winui sample --- Directory.Packages.props | 3 + .../ClientAppsIntegration.AppHost/Program.cs | 4 + .../ClientAppsIntegration.WinUI/App.xaml | 16 +++ .../ClientAppsIntegration.WinUI/App.xaml.cs | 62 +++++++++++ .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 432 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 5372 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 1755 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 637 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 283 bytes .../Assets/StoreLogo.png | Bin 0 -> 456 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 2097 bytes .../ClientAppsIntegration.WinUI.csproj | 64 +++++++++++ .../MainWindow.xaml | 31 ++++++ .../MainWindow.xaml.cs | 75 +++++++++++++ .../Package.appxmanifest | 51 +++++++++ .../PublishProfiles/win-arm64.pubxml | 20 ++++ .../Properties/PublishProfiles/win-x64.pubxml | 20 ++++ .../Properties/PublishProfiles/win-x86.pubxml | 20 ++++ .../Properties/launchSettings.json | 10 ++ .../WeatherApiClient.cs | 18 +++ .../ClientAppsIntegration.WinUI/app.manifest | 19 ++++ .../ClientAppsIntegration.sln | 105 ++++++++++++++++++ 22 files changed, 518 insertions(+) create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml.cs create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/LockScreenLogo.scale-200.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/SplashScreen.scale-200.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/Square150x150Logo.scale-200.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/Square44x44Logo.scale-200.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/StoreLogo.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/Wide310x150Logo.scale-200.png create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/ClientAppsIntegration.WinUI.csproj create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml.cs create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Package.appxmanifest create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-arm64.pubxml create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x64.pubxml create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x86.pubxml create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/launchSettings.json create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/WeatherApiClient.cs create mode 100644 samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/app.manifest diff --git a/Directory.Packages.props b/Directory.Packages.props index 738301bf..7ef6bd32 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,6 +18,7 @@ + @@ -67,5 +68,7 @@ + + \ No newline at end of file diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.AppHost/Program.cs b/samples/ClientAppsIntegration/ClientAppsIntegration.AppHost/Program.cs index 11e9b4e1..da3a2dab 100644 --- a/samples/ClientAppsIntegration/ClientAppsIntegration.AppHost/Program.cs +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.AppHost/Program.cs @@ -11,4 +11,8 @@ builder.AddProject("wpfclient", "../ClientAppsIntegration.WPF/ClientAppsIntegration.WPF.csproj") .WithReference(apiService); +builder.AddProject("winuiclient", "../ClientAppsIntegration.WinUI/ClientAppsIntegration.WinUI.csproj") + .WithReference(apiService); + + builder.Build().Run(); diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml new file mode 100644 index 00000000..e64d60c4 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml.cs b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml.cs new file mode 100644 index 00000000..3b970322 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/App.xaml.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using Microsoft.UI.Xaml.Shapes; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace ClientAppsIntegration.WinUI +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + /// + /// Invoked when the application is launched. + /// + /// Details about the launch request and process. + protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) + { + var builder = Host.CreateApplicationBuilder(); + + builder.AddAppDefaults(); + + var scheme = builder.Environment.IsDevelopment() ? "http" : "https"; + builder.Services.AddHttpClient(client => client.BaseAddress = new($"{scheme}://apiservice")); + + builder.Services.AddSingleton(); + + var appHost = builder.Build(); + var mainWindow = appHost.Services.GetRequiredService(); + + appHost.Start(); + mainWindow.Activate(); + } + + private Window m_window; + } +} diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/LockScreenLogo.scale-200.png b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..7440f0d4bf7c7e26e4e36328738c68e624ee851e GIT binary patch literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(FqV6|IEGZ*x-#9g>~Mkr+x6^F zy~CDX2QIMs&Gcs3RnRBoxBA!*(Mfw0KTCYuYk0WlEIV>qBmPl! zq4ukrvfADX@#p8fbLY(H47N+k`FZ(FZh?cDro7>{8mkBO3>^oaIx`3!Jl)Qq)HI!+ z(S=1{o~eT)&W^=Ea8C`-17(Jv5(nHFJ{dOjGdxLVkY_y6&S1whfuFI4MM0kF0f&cO zPDVpV%nz;Id$>+0Ga5e9625-JcI)oq=#Pa3p^>8BB}21BUw@eN!-6@w%X+^`+Vn?! zryu|3T>kVWNBYyBc=7Y6H#s1Ah!OI_nezW zXTqOdkv2Az6KKBV=$yHdF^R3Fqw(TZEoNSZX>reXJ#bwX42%f|Pgg&ebxsLQ010xn AssI20 literal 0 HcmV?d00001 diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/SplashScreen.scale-200.png b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..32f486a86792a5e34cd9a8261b394c49b48f86be GIT binary patch literal 5372 zcmd5=Z){Ul6u)iv53sCbIJKLzl(EF%0tzcEY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diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/Square44x44Logo.scale-200.png b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..f713bba67f551ef91020b75716a4dc8ebd744b1c GIT binary patch literal 637 zcmeAS@N?(olHy`uVBq!ia0vp^5g^RL1|$oo8kjIJFu8cTIEGZ*dUI*J;2{SImxtDO zm%3!R$UazoY}x{$j0P5ABYXWr(l=jxJ6ps1W{tV=^>{Dl><3nv3A}sm=EZ)#l3`NR zpZda3^rNox*D1%NC98Z~L*6zipLw~Gxn&(Y-;KmJ+aR6eLabU-L#y8HW%7P-E_-VlLqIabbHPHKT*)fT@9iWJ7iWgOT9%0}Lrj>lztPxWq6sPw3pi z#-<=#$jjrP_DD*i!RLsn0mIA=>4~N)IMYWIf=j%-zuKCdMG%tHYot70D1| zvWa0wMhauW#S>1CnI_;>!1Q3zMA17@DOVq{MQ+{U7^a&yA+%dMCG;WNPV0i;w$tu; zX^b}UKziPM)(<;)ruW;-`)bBN+rQNM*Zs_>?n$|FVFo-e*PZb*@U7VAd+tHb4e?=Blc~}S6K)wL}r*Gf`BM#QB z+y>N$mCswb4d{^{S9v_!eQj4fTRMOwOCi?lSk9%<=vAz}jM-*PQtH@Odn1LZcd^j#o> hW$4xn+CT+ep9lJ{OAO?njobhL002ovPDHLkV1nYebbkN< literal 0 HcmV?d00001 diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/StoreLogo.png b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..a4586f26bdf7841cad10f39cdffe2aca3af252c1 GIT binary patch literal 456 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2o;fF!p=8IEGZ*dUM0H=rDtTTVkd2 z(%lbKn@VS_lUaADVB&;Z6F#LM+mPsa?e>FnHo;HND^!P`-lX%BH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wNdKUUYy7GtvZ3asXm)cgFvCx9EmAi;|w=a0iGiv%%VYKh`P0Wma4y`Xyx|T~( zAmfGbgbEEC7)j8b@WA@+5W3a61HJXC1dX@6_T|Czk0I0zBk%tnW~()VWITGI!`$c< gARL?UBrYYkwoDw4eo*CrzXGTrZ@;GF>596)00d&n@&Et; literal 0 HcmV?d00001 diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/ClientAppsIntegration.WinUI.csproj b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/ClientAppsIntegration.WinUI.csproj new file mode 100644 index 00000000..f3af1413 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/ClientAppsIntegration.WinUI.csproj @@ -0,0 +1,64 @@ + + + WinExe + net8.0-windows10.0.19041.0 + 10.0.17763.0 + ClientAppsIntegration.WinUI + app.manifest + x86;x64;ARM64 + win-x86;win-x64;win-arm64 + win-$(Platform).pubxml + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml new file mode 100644 index 00000000..d3e47b16 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml.cs b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml.cs new file mode 100644 index 00000000..8609f0b4 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/MainWindow.xaml.cs @@ -0,0 +1,75 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.UI; +using Microsoft.UI.Xaml; +using Windows.UI.Popups; + + +namespace ClientAppsIntegration.WinUI; + +public sealed partial class MainWindow : Window +{ + //public MainWindow() + //{ + // this.InitializeComponent(); + //} + + private readonly ILogger _logger; + private readonly WeatherApiClient _weatherApiClient; + private readonly CancellationTokenSource _closingCts = new(); + + public MainWindow(ILogger logger, WeatherApiClient weatherApiClient) + { + _logger = logger; + _weatherApiClient = weatherApiClient; + + InitializeComponent(); + + pbLoading.Visibility = Visibility.Collapsed; + dgWeather.Visibility = Visibility.Collapsed; + } + + private async void btnLoad_Click(object sender, RoutedEventArgs e) + { + btnLoad.IsEnabled = false; + pbLoading.Visibility = Visibility.Visible; + + try + { + if (chkForceError.IsChecked == true) + { + throw new InvalidOperationException("Forced error!"); + } + + var weather = await _weatherApiClient.GetWeatherAsync(_closingCts.Token); + dgWeather.ItemsSource = weather; + dgWeather.Visibility = Visibility.Visible; + } + catch (TaskCanceledException) + { + return; + } + catch (Exception ex) + { + _logger.LogError(ex, "Error loading weather"); + + dgWeather.Visibility = Visibility.Collapsed; + dgWeather.ItemsSource = null; + + var dlg = new MessageDialog(ex.Message, "Error"); + var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(this); + WinRT.Interop.InitializeWithWindow.Initialize(dlg, hwnd); + + await dlg.ShowAsync(); + } + + pbLoading.Visibility = Visibility.Collapsed; + btnLoad.IsEnabled = true; + } + + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + _closingCts.Cancel(); + } +} diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Package.appxmanifest b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Package.appxmanifest new file mode 100644 index 00000000..82060632 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Package.appxmanifest @@ -0,0 +1,51 @@ + + + + + + + + + + ClientAppsIntegration.WinUI + NickRandolph + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-arm64.pubxml b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-arm64.pubxml new file mode 100644 index 00000000..d544e386 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-arm64.pubxml @@ -0,0 +1,20 @@ + + + + + FileSystem + ARM64 + win-arm64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + + + \ No newline at end of file diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x64.pubxml b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 00000000..ca40a9e6 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,20 @@ + + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + + + \ No newline at end of file diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x86.pubxml b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x86.pubxml new file mode 100644 index 00000000..be62e6b7 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/PublishProfiles/win-x86.pubxml @@ -0,0 +1,20 @@ + + + + + FileSystem + x86 + win-x86 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + + + \ No newline at end of file diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/launchSettings.json b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/launchSettings.json new file mode 100644 index 00000000..2bf40619 --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "ClientAppsIntegration.WinUI (Package)": { + "commandName": "MsixPackage" + }, + "ClientAppsIntegration.WinUI (Unpackaged)": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/WeatherApiClient.cs b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/WeatherApiClient.cs new file mode 100644 index 00000000..24a0aa3b --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/WeatherApiClient.cs @@ -0,0 +1,18 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace ClientAppsIntegration.WinUI; + +public class WeatherApiClient(HttpClient httpClient) +{ + public async Task GetWeatherAsync(CancellationToken cancellationToken = default) + { + return await httpClient.GetFromJsonAsync("/weatherforecast", cancellationToken) ?? []; + } +} + +public record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/app.manifest b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/app.manifest new file mode 100644 index 00000000..6340b27f --- /dev/null +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.WinUI/app.manifest @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + PerMonitorV2 + + + \ No newline at end of file diff --git a/samples/ClientAppsIntegration/ClientAppsIntegration.sln b/samples/ClientAppsIntegration/ClientAppsIntegration.sln index bd6f3dde..61dd498a 100644 --- a/samples/ClientAppsIntegration/ClientAppsIntegration.sln +++ b/samples/ClientAppsIntegration/ClientAppsIntegration.sln @@ -14,41 +14,146 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientAppsIntegration.AppDe EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{866D6E10-1D89-468B-9790-3F333C2307A6}" ProjectSection(SolutionItems) = preProject + ..\..\Directory.Packages.props = ..\..\Directory.Packages.props README.md = README.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientAppsIntegration.WPF", "ClientAppsIntegration.WPF\ClientAppsIntegration.WPF.csproj", "{76286010-2AB5-4E42-B490-BC87E5595DE6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientAppsIntegration.WinUI", "ClientAppsIntegration.WinUI\ClientAppsIntegration.WinUI.csproj", "{C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|ARM64.Build.0 = Debug|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|x64.ActiveCfg = Debug|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|x64.Build.0 = Debug|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|x86.ActiveCfg = Debug|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Debug|x86.Build.0 = Debug|Any CPU {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|Any CPU.ActiveCfg = Release|Any CPU {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|Any CPU.Build.0 = Release|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|ARM64.ActiveCfg = Release|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|ARM64.Build.0 = Release|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|x64.ActiveCfg = Release|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|x64.Build.0 = Release|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|x86.ActiveCfg = Release|Any CPU + {AF56C3D7-5215-46F6-B9A5-7DC8627A1AAB}.Release|x86.Build.0 = Release|Any CPU {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|ARM64.Build.0 = Debug|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|x64.ActiveCfg = Debug|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|x64.Build.0 = Debug|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|x86.ActiveCfg = Debug|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Debug|x86.Build.0 = Debug|Any CPU {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|Any CPU.ActiveCfg = Release|Any CPU {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|Any CPU.Build.0 = Release|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|ARM64.ActiveCfg = Release|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|ARM64.Build.0 = Release|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|x64.ActiveCfg = Release|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|x64.Build.0 = Release|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|x86.ActiveCfg = Release|Any CPU + {88B59883-83F3-4215-96BC-24EDC497D84C}.Release|x86.Build.0 = Release|Any CPU {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|ARM64.Build.0 = Debug|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|x64.ActiveCfg = Debug|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|x64.Build.0 = Debug|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|x86.ActiveCfg = Debug|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Debug|x86.Build.0 = Debug|Any CPU {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|Any CPU.ActiveCfg = Release|Any CPU {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|Any CPU.Build.0 = Release|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|ARM64.ActiveCfg = Release|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|ARM64.Build.0 = Release|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|x64.ActiveCfg = Release|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|x64.Build.0 = Release|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|x86.ActiveCfg = Release|Any CPU + {35286E8E-7BE7-4CAE-B11B-DC9BD23AEABC}.Release|x86.Build.0 = Release|Any CPU {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|ARM64.Build.0 = Debug|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|x64.ActiveCfg = Debug|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|x64.Build.0 = Debug|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|x86.ActiveCfg = Debug|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Debug|x86.Build.0 = Debug|Any CPU {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|Any CPU.ActiveCfg = Release|Any CPU {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|Any CPU.Build.0 = Release|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|ARM64.ActiveCfg = Release|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|ARM64.Build.0 = Release|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|x64.ActiveCfg = Release|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|x64.Build.0 = Release|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|x86.ActiveCfg = Release|Any CPU + {A566A703-4045-4AE5-89D9-643AC7D66BDF}.Release|x86.Build.0 = Release|Any CPU {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|ARM64.Build.0 = Debug|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|x64.ActiveCfg = Debug|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|x64.Build.0 = Debug|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|x86.ActiveCfg = Debug|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Debug|x86.Build.0 = Debug|Any CPU {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|Any CPU.ActiveCfg = Release|Any CPU {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|Any CPU.Build.0 = Release|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|ARM64.ActiveCfg = Release|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|ARM64.Build.0 = Release|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|x64.ActiveCfg = Release|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|x64.Build.0 = Release|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|x86.ActiveCfg = Release|Any CPU + {3997CEA7-914F-4A3E-8955-766B846E72BB}.Release|x86.Build.0 = Release|Any CPU {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|ARM64.Build.0 = Debug|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|x64.ActiveCfg = Debug|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|x64.Build.0 = Debug|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|x86.ActiveCfg = Debug|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Debug|x86.Build.0 = Debug|Any CPU {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|Any CPU.ActiveCfg = Release|Any CPU {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|Any CPU.Build.0 = Release|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|ARM64.ActiveCfg = Release|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|ARM64.Build.0 = Release|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|x64.ActiveCfg = Release|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|x64.Build.0 = Release|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|x86.ActiveCfg = Release|Any CPU + {76286010-2AB5-4E42-B490-BC87E5595DE6}.Release|x86.Build.0 = Release|Any CPU + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|Any CPU.ActiveCfg = Debug|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|Any CPU.Build.0 = Debug|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|Any CPU.Deploy.0 = Debug|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|ARM64.Build.0 = Debug|ARM64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|x64.ActiveCfg = Debug|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|x64.Build.0 = Debug|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|x64.Deploy.0 = Debug|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|x86.ActiveCfg = Debug|x86 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|x86.Build.0 = Debug|x86 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Debug|x86.Deploy.0 = Debug|x86 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|Any CPU.ActiveCfg = Release|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|Any CPU.Build.0 = Release|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|Any CPU.Deploy.0 = Release|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|ARM64.ActiveCfg = Release|ARM64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|ARM64.Build.0 = Release|ARM64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|ARM64.Deploy.0 = Release|ARM64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|x64.ActiveCfg = Release|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|x64.Build.0 = Release|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|x64.Deploy.0 = Release|x64 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|x86.ActiveCfg = Release|x86 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|x86.Build.0 = Release|x86 + {C1228843-7DBE-4D4D-A8FE-CE905E9A00E8}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE