From 5f65cb3b1ffd392a2fad02311baa6f378ec3c2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E6=80=A1=E9=A3=9E?= <363301617@qq.com> Date: Wed, 12 Jun 2024 09:46:34 +0800 Subject: [PATCH] Add CsWinRT Package reference Add CsWinRT Package reference --- GetStoreApp/GetStoreApp.csproj | 5 +++-- .../UI/Dialogs/Settings/RestartAppsDialog.xaml.cs | 6 +++--- GetStoreApp/WinUIApp.xaml.cs | 12 ------------ GetStoreAppWebView/GetStoreAppWebView.csproj | 3 ++- ...Microsoft.Management.Deployment.Projection.csproj | 6 +++--- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/GetStoreApp/GetStoreApp.csproj b/GetStoreApp/GetStoreApp.csproj index e172116f..a0b78c11 100644 --- a/GetStoreApp/GetStoreApp.csproj +++ b/GetStoreApp/GetStoreApp.csproj @@ -22,7 +22,7 @@ x86;x64;ARM64 FileSystem False - true + true True true PackageReference @@ -117,7 +117,8 @@ - + + diff --git a/GetStoreApp/UI/Dialogs/Settings/RestartAppsDialog.xaml.cs b/GetStoreApp/UI/Dialogs/Settings/RestartAppsDialog.xaml.cs index 3ae67a80..e4927bef 100644 --- a/GetStoreApp/UI/Dialogs/Settings/RestartAppsDialog.xaml.cs +++ b/GetStoreApp/UI/Dialogs/Settings/RestartAppsDialog.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls; +using Microsoft.Windows.AppLifecycle; // 抑制 CA1822,IDE0060 警告 #pragma warning disable CA1822,IDE0060 @@ -21,7 +21,7 @@ public RestartAppsDialog() /// private void OnRestartAppsClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args) { - (Application.Current as WinUIApp).Restart(); + AppInstance.Restart("Restart"); } } } diff --git a/GetStoreApp/WinUIApp.xaml.cs b/GetStoreApp/WinUIApp.xaml.cs index 3265a216..afd90fee 100644 --- a/GetStoreApp/WinUIApp.xaml.cs +++ b/GetStoreApp/WinUIApp.xaml.cs @@ -6,7 +6,6 @@ using Microsoft.UI; using Microsoft.UI.Xaml; using System; -using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; using Windows.Foundation.Diagnostics; @@ -120,17 +119,6 @@ private void SetAppIcon() } } - /// - /// 重启应用 - /// - public void Restart() - { - MainWindow.Current.AppWindow.Hide(); - ProcessHelper.StartProcess(Path.Combine(InfoHelper.AppInstalledLocation, "GetStoreApp.exe"), "Restart", out _); - - Dispose(); - } - /// /// 释放资源 /// diff --git a/GetStoreAppWebView/GetStoreAppWebView.csproj b/GetStoreAppWebView/GetStoreAppWebView.csproj index 85be673c..f72d5904 100644 --- a/GetStoreAppWebView/GetStoreAppWebView.csproj +++ b/GetStoreAppWebView/GetStoreAppWebView.csproj @@ -61,7 +61,8 @@ - + + diff --git a/Microsoft.Management.Deployment.Projection/Microsoft.Management.Deployment.Projection.csproj b/Microsoft.Management.Deployment.Projection/Microsoft.Management.Deployment.Projection.csproj index 3e550dfe..7c944496 100644 --- a/Microsoft.Management.Deployment.Projection/Microsoft.Management.Deployment.Projection.csproj +++ b/Microsoft.Management.Deployment.Projection/Microsoft.Management.Deployment.Projection.csproj @@ -1,13 +1,13 @@  - Microsoft.Management.Deployment + Microsoft.Management.Deployment 10.0.22621.0 true false true x64;x86;ARM64 - true - full + true + full net9.0-windows10.0.22621.0 10.0.19041.0 10.0.22621.35-preview