Skip to content

Commit

Permalink
Add CsWinRT Package reference
Browse files Browse the repository at this point in the history
Add CsWinRT Package reference
  • Loading branch information
Gaoyifei1011 committed Jun 12, 2024
1 parent 9e21c22 commit 5f65cb3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 21 deletions.
5 changes: 3 additions & 2 deletions GetStoreApp/GetStoreApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<Platforms>x86;x64;ARM64</Platforms>
<PublishProtocol>FileSystem</PublishProtocol>
<PublishReadyToRun>False</PublishReadyToRun>
<PublishSelfContained>true</PublishSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<PublishSingleFile>True</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
Expand Down Expand Up @@ -117,7 +117,8 @@
<None Remove="Views\Pages\WinGetPage.xaml" />
<None Remove="Views\Windows\MainWindow.xaml" />
<None Remove="WinUIApp.xaml" />


<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.0-prerelease.240602.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240531000-experimental1" />

<Page Update="Styles\AppBarButton.xaml" XamlRuntime="$(DefaultXamlRuntime)" />
Expand Down
6 changes: 3 additions & 3 deletions GetStoreApp/UI/Dialogs/Settings/RestartAppsDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,7 +21,7 @@ public RestartAppsDialog()
/// </summary>
private void OnRestartAppsClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
(Application.Current as WinUIApp).Restart();
AppInstance.Restart("Restart");
}
}
}
12 changes: 0 additions & 12 deletions GetStoreApp/WinUIApp.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -120,17 +119,6 @@ private void SetAppIcon()
}
}

/// <summary>
/// 重启应用
/// </summary>
public void Restart()
{
MainWindow.Current.AppWindow.Hide();
ProcessHelper.StartProcess(Path.Combine(InfoHelper.AppInstalledLocation, "GetStoreApp.exe"), "Restart", out _);

Dispose();
}

/// <summary>
/// 释放资源
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion GetStoreAppWebView/GetStoreAppWebView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
<None Remove="UI\Dialogs\ProcessFailedDialog.xaml" />
<None Remove="WebApp.xaml" />
<None Remove="WebWindow.xaml" />


<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.0-prerelease.240602.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240531000-experimental1" GeneratePathProperty="true" />

<Page Remove="WebApp.xaml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<CsWinRTIncludes>Microsoft.Management.Deployment</CsWinRTIncludes>
<CsWinRTIncludes>Microsoft.Management.Deployment</CsWinRTIncludes>
<CSWinRTWindowsMetadata>10.0.22621.0</CSWinRTWindowsMetadata>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsTrimmable>true</IsTrimmable>
<Platforms>x64;x86;ARM64</Platforms>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>full</TrimMode>
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.22621.35-preview</WindowsSdkPackageVersion>
Expand Down

0 comments on commit 5f65cb3

Please sign in to comment.