Skip to content

Commit

Permalink
更新到 WinAppSDK 1.6 (#74)
Browse files Browse the repository at this point in the history
* update

* Fix

* Update
  • Loading branch information
Richasy authored Sep 24, 2024
1 parent e3c86d4 commit da742d1
Show file tree
Hide file tree
Showing 144 changed files with 948 additions and 686 deletions.
12 changes: 12 additions & 0 deletions src/App.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@
<Rules AnalyzerId="Microsoft.CodeAnalysis.NetAnalyzers" RuleNamespace="Microsoft.CodeAnalysis.NetAnalyzers">
<Rule Id="CA1416" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.VisualStudio.Threading.Analyzers" RuleNamespace="Microsoft.VisualStudio.Threading.Analyzers">
<Rule Id="VSTHRD100" Action="None" />
<Rule Id="VSTHRD101" Action="None" />
<Rule Id="VSTHRD200" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.VisualStudio.Threading.Analyzers.CSharp" RuleNamespace="Microsoft.VisualStudio.Threading.Analyzers.CSharp">
<Rule Id="VSTHRD003" Action="None" />
<Rule Id="VSTHRD110" Action="None" />
</Rules>
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp.Analyzers">
<Rule Id="RCS1075" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA0001" Action="None" />
<Rule Id="SA1000" Action="None" />
Expand Down
10 changes: 5 additions & 5 deletions src/Console/RodelAudio.Console/RodelAudio.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Localization" />
<PackageReference Include="Spectre.Console" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Core\RodelAgent.Statics\RodelAgent.Statics.csproj" />
Expand Down
8 changes: 4 additions & 4 deletions src/Console/RodelChat.Console/RodelChat.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Localization" />
<PackageReference Include="Spectre.Console" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>

<ItemGroup>
Expand Down
60 changes: 30 additions & 30 deletions src/Console/RodelDraw.Console/RodelDraw.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,39 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Localization" />
<PackageReference Include="Spectre.Console" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Core\RodelAgent.Interfaces\RodelAgent.Interfaces.csproj" />
<ProjectReference Include="..\..\Core\RodelAgent.Statics\RodelAgent.Statics.csproj" />
<ProjectReference Include="..\..\Core\RodelDraw.Core\RodelDraw.Core.csproj" />
<ProjectReference Include="..\..\Core\RodelDraw.Interfaces\RodelDraw.Interfaces.csproj" />
<ProjectReference Include="..\..\Core\RodelDraw.Models\RodelDraw.Models.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\RodelAgent.Interfaces\RodelAgent.Interfaces.csproj" />
<ProjectReference Include="..\..\Core\RodelAgent.Statics\RodelAgent.Statics.csproj" />
<ProjectReference Include="..\..\Core\RodelDraw.Core\RodelDraw.Core.csproj" />
<ProjectReference Include="..\..\Core\RodelDraw.Interfaces\RodelDraw.Interfaces.csproj" />
<ProjectReference Include="..\..\Core\RodelDraw.Models\RodelDraw.Models.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\DrawService.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>DrawService.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\DrawService.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>DrawService.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\DrawService.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>DrawService.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\DrawService.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>DrawService.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Localization" />
<PackageReference Include="Spectre.Console" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Core/RodelAgent.Context/RodelAgent.Context.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Core/RodelAgent.Models/RodelAgent.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.ComponentModel.Annotations" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Core/RodelAgent.Statics/RodelAgent.Statics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/RodelAudio.Models/RodelAudio.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/RodelChat.Core/RodelChat.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>SKEXP0110;SKEXP0010;SKEXP0001</NoWarn>
<NoWarn>$(NoWarn);SKEXP0110</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/RodelChat.Models/RodelChat.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/RodelDraw.Models/RodelDraw.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/RodelTranslate.Core/RodelTranslate.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Core/RodelTranslate.Models/RodelTranslate.Models.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ public enum SettingNames
IsDrawHistoryColumnManualHide,
IsAudioHistoryColumnManualHide,
LastSelectedFeaturePage,
IsInternalPromptTest,
}
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/Desktop/RodelAgent.UI/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

<x:Double x:Key="WindowNarrowMinWidth">850</x:Double>

<converters:BoolToIconVariantConverter x:Key="BoolToIconVariantConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityReverseConverter" IsReverse="True" />
Expand Down
72 changes: 43 additions & 29 deletions src/Desktop/RodelAgent.UI/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Rodel. All rights reserved.

using System.Web;
using H.NotifyIcon;
using Microsoft.UI.Dispatching;
using Microsoft.Windows.AppLifecycle;
Expand Down Expand Up @@ -126,47 +127,60 @@ private void InitializeTrayIcon()

private async Task LaunchWindowAsync(IActivatedEventArgs args = default)
{
var instance = AppInstance.FindOrRegisterForKey(Id);
if (args is IProtocolActivatedEventArgs protocolArgs
&& !string.IsNullOrEmpty(protocolArgs.Uri.Host))
{
// 处理协议启动.
if (protocolArgs.Uri.Host == "internal")
{
var query = protocolArgs.Uri.Query;
var queryItems = HttpUtility.ParseQueryString(query);
var feature = queryItems["feature"]?.ToLower() ?? string.Empty;
if (!string.IsNullOrEmpty(feature))
{
if (feature == "prompt-test")
{
SettingsToolkit.WriteLocalSetting(SettingNames.IsInternalPromptTest, true);
}
else if(feature == "clear")
{
SettingsToolkit.WriteLocalSetting(SettingNames.IsInternalPromptTest, false);
}
}
}
}
else

// If the current instance is not the previously registered instance
if (!instance.IsCurrent)
{
var instance = AppInstance.FindOrRegisterForKey(Id);
var activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs();

// If the current instance is not the previously registered instance
if (!instance.IsCurrent)
{
var activatedArgs = AppInstance.GetCurrent().GetActivatedEventArgs();
// Redirect to the existing instance
await instance.RedirectActivationToAsync(activatedArgs);

// Redirect to the existing instance
await instance.RedirectActivationToAsync(activatedArgs);
// Kill the current instance
Current.Exit();
return;
}

// Kill the current instance
Current.Exit();
return;
}
var shouldSkipStartup = SettingsToolkit.ReadLocalSetting(SettingNames.ShouldSkipStartup, false);
if (!shouldSkipStartup)
{
var window = new StartupWindow();
window.Activate();
}
else
{
_window = new MainWindow();
_window.Closed += OnMainWindowClosedAsync;

var shouldSkipStartup = SettingsToolkit.ReadLocalSetting(SettingNames.ShouldSkipStartup, false);
if (!shouldSkipStartup)
HandleCloseEvents = SettingsToolkit.ReadLocalSetting(SettingNames.HideWhenCloseWindow, true);
if (HandleCloseEvents)
{
var window = new StartupWindow();
window.Activate();
InitializeTrayIcon();
}
else
{
_window = new MainWindow();
_window.Closed += OnMainWindowClosedAsync;

HandleCloseEvents = SettingsToolkit.ReadLocalSetting(SettingNames.HideWhenCloseWindow, true);
if (HandleCloseEvents)
{
InitializeTrayIcon();
}

_window.Activate();
}
_window.Activate();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
x:Class="RodelAgent.UI.Controls.Audio.AudioHistorySection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:client="using:RodelAudio.Models.Client"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="using:RodelAgent.UI.Extensions"
xmlns:ic="using:FluentIcons.WinUI"
xmlns:items="using:RodelAgent.UI.ViewModels.Items"
xmlns:local="using:RodelAgent.UI.Controls.Audio"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
Expand Down Expand Up @@ -63,7 +63,7 @@
<Grid Margin="0,12,0,20">
<ItemsRepeater ItemsSource="{x:Bind ViewModel.History}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="client:AudioSession">
<DataTemplate x:DataType="items:AudioSessionItemViewModel">
<local:AudioSessionItemControl ViewModel="{x:Bind}" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
Expand Down
Loading

0 comments on commit da742d1

Please sign in to comment.