Skip to content

Commit 28d86b3

Browse files
committed
chore: 更新至 .Net 9
1 parent af899a6 commit 28d86b3

File tree

6 files changed

+17
-40
lines changed

6 files changed

+17
-40
lines changed

src/DotVast.HashTool.WinUI.Core.Tests/DotVast.HashTool.WinUI.Core.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<RootNamespace>DotVast.HashTool.WinUI.Core.Tests</RootNamespace>
66

77
<IsPackable>false</IsPackable>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<RootNamespace>DotVast.HashTool.WinUI.Core</RootNamespace>
55
</PropertyGroup>
66
</Project>

src/DotVast.HashTool.WinUI/DotVast.HashTool.WinUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
4-
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
4+
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
55
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
66
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
77
<Platforms>x64;arm64</Platforms>

src/DotVast.HashTool.WinUI/Models/HashOption.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace DotVast.HashTool.WinUI.Models;
99

10-
public sealed class HashOption : ObservableObject
10+
public sealed partial class HashOption : ObservableObject
1111
{
1212
public HashKind Kind
1313
{

src/DotVast.HashTool.WinUI/Models/HashResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class HashResult(string path, IReadOnlyList<HashResultItem> data)
2121
public IReadOnlyList<HashResultItem> Data { get; } = data;
2222
}
2323

24-
public sealed class HashResultItem : ObservableObject
24+
public sealed partial class HashResultItem : ObservableObject
2525
{
2626
private readonly HashOption _hashOption;
2727
private readonly byte[] _hashValue;

src/DotVast.HashTool.WinUI/Services/PageService.cs

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,29 @@
22
// Licensed under the MIT License.
33

44
using DotVast.HashTool.WinUI.Enums;
5-
using DotVast.HashTool.WinUI.ViewModels;
65
using DotVast.HashTool.WinUI.Views;
76

8-
using Microsoft.UI.Xaml.Controls;
9-
107
namespace DotVast.HashTool.WinUI.Services;
118

129
public sealed class PageService : IPageService
1310
{
14-
private readonly Dictionary<PageKey, Type> _pages = [];
11+
private readonly Lock _lock = new();
12+
private readonly Dictionary<PageKey, Type> _pages = new()
13+
{
14+
{ PageKey.SettingsPage, typeof(SettingsPage)},
15+
{ PageKey.HomePage, typeof(HomePage)},
16+
{ PageKey.TasksPage, typeof(TasksPage)},
17+
{ PageKey.ResultsPage, typeof(ResultsPage)},
18+
{ PageKey.LicensesPage, typeof(LicensesPage)},
19+
{ PageKey.HashSettingsPage, typeof(HashSettingsPage)},
20+
};
1521

16-
public PageService()
17-
{
18-
Configure<SettingsViewModel, SettingsPage>(PageKey.SettingsPage);
19-
Configure<HomeViewModel, HomePage>(PageKey.HomePage);
20-
Configure<TasksViewModel, TasksPage>(PageKey.TasksPage);
21-
Configure<ResultsViewModel, ResultsPage>(PageKey.ResultsPage);
22-
Configure<LicensesViewModel, LicensesPage>(PageKey.LicensesPage);
23-
Configure<HashSettingsViewModel, HashSettingsPage>(PageKey.HashSettingsPage);
24-
}
22+
public PageService() { }
2523

2624
public Type GetPageType(PageKey key)
2725
{
2826
Type? pageType;
29-
lock (_pages)
27+
lock (_lock)
3028
{
3129
if (!_pages.TryGetValue(key, out pageType))
3230
{
@@ -36,25 +34,4 @@ public Type GetPageType(PageKey key)
3634

3735
return pageType;
3836
}
39-
40-
private void Configure<VM, V>(PageKey key)
41-
where VM : IViewModel
42-
where V : Page, IView<VM>
43-
{
44-
lock (_pages)
45-
{
46-
if (_pages.ContainsKey(key))
47-
{
48-
throw new ArgumentException($"The key {key} is already configured in PageService");
49-
}
50-
51-
var type = typeof(V);
52-
if (_pages.ContainsValue(type))
53-
{
54-
throw new ArgumentException($"This type is already configured with key {_pages.First(p => p.Value == type).Key}");
55-
}
56-
57-
_pages.Add(key, type);
58-
}
59-
}
6037
}

0 commit comments

Comments
 (0)