返回提交历史
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Utilities/CloudLyricsReader.cs
+15
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/App.xaml.cs
+25
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/HaloPixelToolBox.csproj
+3
-3
Added
HaloPixelToolBox/HaloPixelToolBox/Implements/Services/UpgradeService.cs
+19
-0
Added
HaloPixelToolBox/HaloPixelToolBox/Interface/Services/IUpgradeService.cs
+9
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/Styles/ConverterResources.xaml
+1
-0
Added
HaloPixelToolBox/HaloPixelToolBox/Utilities/Converter/StringEmptyBooleanConverter.cs
+16
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/ViewModels/AppShellPageViewModel.cs
+57
-45
Modified
HaloPixelToolBox/HaloPixelToolBox/ViewModels/CloudMusicLyricsToolPageViewModel.cs
+88
-62
Modified
HaloPixelToolBox/HaloPixelToolBox/ViewModels/SettingPageViewModel.cs
+12
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/CloudMusicLyricsToolPage.xaml
+1
-1
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/CloudMusicLyricsToolPage.xaml.cs
+3
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/SettingPage.xaml
+15
-1
XFEstudio/HaloPixelToolBox
更新适配了网易云 3.1.26版本 现在可以在设置页面里面删除忽略的版本号 现在可以在设置页面中检查更新 保留历史网易云版本,现在更新软件后可以无需更新网易云(但是网易云新版本仍需要更新软件才能使用) 修复部分已知问题 添加详细日志信息
ed4771d
代码差异
13 个文件
+264
-115
@@ -9,6 +9,7 @@ public class CloudMusicLyricsReader
9
9
{
10
10
public nint Address { get; set; }
11
11
public FileVersionInfo? VersionInfo { get; set; }
12
public Version Version { get; set; } = new();
12
13
public MemoryEditor Editor { get; set; } = new();
13
14
14
15
public bool Initialize()
@@ -18,6 +19,8 @@ public class CloudMusicLyricsReader
18
19
Console.WriteLine($"[DEBUG]已找到进程:{process.ProcessName}({process.Id}|{process.Id:X}) - {process.MainWindowTitle}");
19
20
Editor.CurrentProcess = process;
20
21
VersionInfo = FileVersionInfo.GetVersionInfo(process.MainModule?.FileName ?? string.Empty);
22
Version = new Version(VersionInfo?.FileVersion ?? "0.0.0.0");
23
Console.WriteLine($"[DEBUG]版本信息:{VersionInfo?.FileVersion}|{Version.ToString(3)}");
21
24
return ReresolveAddress();
22
25
}
23
26
else
@@ -41,7 +44,18 @@ public class CloudMusicLyricsReader
41
44
{
42
45
try
43
46
{
44
var address = Editor.ResolvePointerAddress("cloudmusic.dll", 0x01DAFF60, 0xE0, 0x8, 0x128, 0x18, 0x0);
47
nint address = 0;
48
switch (Version.ToString(3))
49
{
50
case "3.1.26":
51
address = Editor.ResolvePointerAddress("cloudmusic.dll", 0x01DD5130, 0xE8, 0x38, 0x120, 0x18, 0x0);
52
break;
53
case "3.1.25":
54
address = Editor.ResolvePointerAddress("cloudmusic.dll", 0x01DAFF60, 0xE0, 0x8, 0x128, 0x18, 0x0);
55
break;
56
default:
57
break;
58
}
45
59
if (address != Address)
46
60
Console.WriteLine($"[DEBUG]读取到新的地址:{address}({address:X})");
47
61
if (address != 0)
@@ -1,8 +1,8 @@
1
1
using HaloPixelToolBox.Interface.Services;
2
2
using HaloPixelToolBox.Profiles.CrossVersionProfiles;
3
3
using HaloPixelToolBox.Utilities;
4
using HaloPixelToolBox.Utilities.Helpers;
5
4
using Microsoft.UI.Dispatching;
5
using Microsoft.Windows.AppLifecycle;
6
6
using XFEExtension.NetCore.WinUIHelper.Interface.Services;
7
7
using XFEExtension.NetCore.WinUIHelper.Utilities;
8
8
using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
@@ -28,6 +28,13 @@ public partial class App : Application
28
28
/// </summary>
29
29
public App()
30
30
{
31
var keyInstance = AppInstance.FindOrRegisterForKey("MainInstance");
32
if (!keyInstance.IsCurrent)
33
{
34
keyInstance.RedirectActivationToAsync(AppInstance.GetCurrent().GetActivatedEventArgs()).AsTask().Wait();
35
Environment.Exit(0);
36
return;
37
}
31
38
XFEConsole.UseXFEConsoleLog();
32
39
XFEConsole.Log.LogPath = Path.Combine(AppPath.LogDictionary, XFEConsole.Log.LogPath);
33
40
Console.WriteLine("正在初始化应用程序...");
@@ -41,6 +48,21 @@ public partial class App : Application
41
48
UnhandledException += App_UnhandledException;
42
49
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
43
50
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
51
AppInstance.GetCurrent().Activated += App_Activated;
52
Console.WriteLine("事件订阅完成");
53
}
54
55
private void App_Activated(object? sender, AppActivationArguments e)
56
{
57
if (e.Kind == ExtendedActivationKind.Launch)
58
{
59
MainWindow.DispatcherQueue.TryEnqueue(() =>
60
{
61
if (SystemProfile.MinimizeWhenOpen)
62
MainWindow.AppWindow.Show();
63
MainWindow.Activate();
64
});
65
}
44
66
}
45
67
46
68
private void CurrentDomain_UnhandledException(object sender, System.UnhandledExceptionEventArgs e)
@@ -89,6 +111,7 @@ public partial class App : Application
89
111
/// <param name="args">Details about the launch request and process.</param>
90
112
protected override void OnLaunched(LaunchActivatedEventArgs args)
91
113
{
114
Console.WriteLine("主窗体启动中...");
92
115
TrayIconService.Initilize(DispatcherQueue.GetForCurrentThread());
93
116
CloseWindowService.Initialize(MainWindow);
94
117
MainWindow.Content = new AppShellPage();
@@ -98,5 +121,6 @@ public partial class App : Application
98
121
else
99
122
MainWindow.Activate();
100
123
AppThemeHelper.MainWindow = MainWindow;
124
Console.WriteLine("主窗体启动完成");
101
125
}
102
126
}
@@ -9,7 +9,7 @@
9
9
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
10
10
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
11
11
<UseWinUI>true</UseWinUI>
12
<Version>1.2.0</Version>
12
<Version>1.2.1</Version>
13
13
<EnableMsixTooling>true</EnableMsixTooling>
14
14
<WindowsPackageType>None</WindowsPackageType>
15
15
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
@@ -73,8 +73,8 @@
73
73
</ItemGroup>
74
74
<ItemGroup>
75
75
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
76
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.*" />
77
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.251106002" />
76
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7463" />
77
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.*" />
78
78
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
79
79
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.251219" />
80
80
<PackageReference Include="XFEExtension.NetCore" Version="3.3.*" />
@@ -0,0 +1,19 @@
1
using HaloPixelToolBox.Interface.Services;
2
using XFEExtension.NetCore.WinUIHelper.Implements.Services;
3
4
namespace HaloPixelToolBox.Implements.Services;
5
6
public class UpgradeService : GlobalServiceBase, IUpgradeService
7
{
8
Func<Task>? checkUpgradeAction;
9
10
public async Task<bool> CheckUpgrade()
11
{
12
if (checkUpgradeAction is null)
13
return false;
14
await checkUpgradeAction();
15
return true;
16
}
17
18
public void Initialize(Func<Task> checkUpgradeAction) => this.checkUpgradeAction = checkUpgradeAction;
19
}
@@ -0,0 +1,9 @@
1
using XFEExtension.NetCore.WinUIHelper.Interface.Services;
2
3
namespace HaloPixelToolBox.Interface.Services;
4
5
public interface IUpgradeService : IGlobalService
6
{
7
void Initialize(Func<Task> checkUpgradeAction);
8
Task<bool> CheckUpgrade();
9
}
@@ -10,5 +10,6 @@
10
10
<converter:DateTimeOffsetConverter x:Key="DateTimeOffsetConverter"/>
11
11
<converter:EmptyStringConverter x:Key="EmptyStringConverter"/>
12
12
<innerconverter:StringEmptyVisibilityConverter x:Key="StringEmptyVisibilityConverter"/>
13
<innerconverter:StringEmptyBooleanConverter x:Key="StringEmptyBooleanConverter"/>
13
14
<innerconverter:BooleanInverseConverter x:Key="BooleanInverseConverter"/>
14
15
</ResourceDictionary>
@@ -0,0 +1,16 @@
1
using Microsoft.UI.Xaml.Data;
2
using XFEExtension.NetCore.StringExtension;
3
4
namespace HaloPixelToolBox.Utilities.Converter;
5
6
public partial class StringEmptyBooleanConverter : IValueConverter
7
{
8
public object Convert(object value, Type targetType, object parameter, string language)
9
{
10
var inverse = parameter is string parameterString && parameterString == "inverse";
11
var empty = value is not string stringValue || stringValue.IsNullOrEmpty();
12
return inverse ? !empty : empty;
13
}
14
15
public object ConvertBack(object value, Type targetType, object parameter, string language) => value;
16
}
@@ -24,11 +24,12 @@ public partial class AppShellPageViewModel : ViewModelBase
24
24
[ObservableProperty]
25
25
private ImageSource userTile = Win32Helper.GetUserTile();
26
26
27
public IDialogService DialogService { get; set; } = ServiceManager.GetService<IDialogService>();
28
public INavigationViewService NavigationViewService { get; set; } = ServiceManager.GetService<INavigationViewService>();
27
public IDialogService DialogService { get; } = ServiceManager.GetService<IDialogService>();
28
public INavigationViewService NavigationViewService { get; } = ServiceManager.GetService<INavigationViewService>();
29
29
public Interface.Services.IPageService PageService { get; } = ServiceManager.GetService<Interface.Services.IPageService>();
30
public IMessageService MessageService { get; set; } = ServiceManager.GetService<IMessageService>();
31
public ILoadingService LoadingService { get; set; } = ServiceManager.GetService<ILoadingService>();
30
public IMessageService MessageService { get; } = ServiceManager.GetService<IMessageService>();
31
public ILoadingService LoadingService { get; } = ServiceManager.GetService<ILoadingService>();
32
public IUpgradeService UpgradeService { get; } = ServiceManager.GetService<IUpgradeService>();
32
33
public ICloseWindowService? CloseWindowService { get; } = ServiceManager.GetGlobalService<ICloseWindowService>();
33
34
34
35
public AppShellPageViewModel()
@@ -37,6 +38,57 @@ public partial class AppShellPageViewModel : ViewModelBase
37
38
PageService.CurrentPageLoaded += CurrentPage_Loaded;
38
39
if (CloseWindowService is not null)
39
40
CloseWindowService.Closed += CloseWindowService_Closed;
41
UpgradeService.Initialize(async () =>
42
{
43
try
44
{
45
MessageService.ShowMessage("正在检查更新...", "检查更新", InfoBarSeverity.Informational);
46
Console.WriteLine("正在检查更新...");
47
var upgradeInfo = await UpgradeHelper.GetReleaseNotes();
48
if (upgradeInfo.IsLatest)
49
{
50
MessageService.ShowMessage("当前已是最新版本", "检查更新", InfoBarSeverity.Success);
51
Console.WriteLine("当前已是最新版本");
52
}
53
else
54
{
55
if (upgradeInfo.LatestVersion == SystemProfile.IgnoreVersion)
56
{
57
MessageService.ShowMessage("当前版本已被忽略", "检查更新", InfoBarSeverity.Informational);
58
Console.WriteLine("当前版本已被忽略");
59
}
60
else
61
{
62
MessageService.ShowMessage("检测到新版本", "检查更新", InfoBarSeverity.Informational);
63
Console.WriteLine("检测到新版本");
64
Console.WriteLine($"[DEBUG]最新版本: {upgradeInfo.LatestVersion}");
65
Console.WriteLine($"[DEBUG]当前版本: {UpgradeHelper.Version}");
66
Console.WriteLine($"[DEBUG]更新信息:{upgradeInfo.ReleaseNotes}");
67
UpgradeContentText = upgradeInfo.ReleaseNotes;
68
switch (await DialogService.ShowDialog("upgradeDialog"))
69
{
70
case ContentDialogResult.None:
71
Console.WriteLine("用户取消了更新");
72
break;
73
case ContentDialogResult.Primary:
74
Console.WriteLine("用户选择开始更新...");
75
UpgradeHelper.StartUpdate(upgradeInfo.DownloadUrl);
76
break;
77
case ContentDialogResult.Secondary:
78
Console.WriteLine("用户选择忽略当前版本");
79
SystemProfile.IgnoreVersion = upgradeInfo.LatestVersion;
80
break;
81
default:
82
break;
83
}
84
}
85
}
86
}
87
catch (Exception ex)
88
{
89
Console.WriteLine($"[ERROR]检查更新时发生错误:{ex}");
90
}
91
});
40
92
}
41
93
42
94
private async void CloseWindowService_Closed(object sender, WindowEventArgs args)
@@ -68,47 +120,7 @@ public partial class AppShellPageViewModel : ViewModelBase
68
120
69
121
private async void CurrentPage_Loaded(object sender, RoutedEventArgs e)
70
122
{
71
MessageService.ShowMessage("正在检查更新...", "检查更新", InfoBarSeverity.Informational);
72
Console.WriteLine("正在检查更新...");
73
var upgradeInfo = await UpgradeHelper.GetReleaseNotes();
74
if (upgradeInfo.IsLatest)
75
{
76
MessageService.ShowMessage("当前已是最新版本", "检查更新", InfoBarSeverity.Success);
77
Console.WriteLine("当前已是最新版本");
78
}
79
else
80
{
81
if (upgradeInfo.LatestVersion == SystemProfile.IgnoreVersion)
82
{
83
MessageService.ShowMessage("当前版本已被忽略", "检查更新", InfoBarSeverity.Informational);
84
Console.WriteLine("当前版本已被忽略");
85
}
86
else
87
{
88
MessageService.ShowMessage("检测到新版本", "检查更新", InfoBarSeverity.Informational);
89
Console.WriteLine("检测到新版本");
90
Console.WriteLine($"[DEBUG]最新版本: {upgradeInfo.LatestVersion}");
91
Console.WriteLine($"[DEBUG]当前版本: {UpgradeHelper.Version}");
92
Console.WriteLine($"[DEBUG]更新信息:{upgradeInfo.ReleaseNotes}");
93
UpgradeContentText = upgradeInfo.ReleaseNotes;
94
switch (await DialogService.ShowDialog("upgradeDialog"))
95
{
96
case ContentDialogResult.None:
97
Console.WriteLine("用户取消了更新");
98
break;
99
case ContentDialogResult.Primary:
100
Console.WriteLine("用户选择开始更新...");
101
UpgradeHelper.StartUpdate(upgradeInfo.DownloadUrl);
102
break;
103
case ContentDialogResult.Secondary:
104
Console.WriteLine("用户选择忽略当前版本");
105
SystemProfile.IgnoreVersion = upgradeInfo.LatestVersion;
106
break;
107
default:
108
break;
109
}
110
}
111
}
123
await UpgradeService.CheckUpgrade();
112
124
}
113
125
114
126
private void NavigationService_Navigated(object? sender, NavigationEventArgs e) => CanGoBack = NavigationViewService.NavigationService.CanGoBack;
@@ -36,23 +36,33 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
36
36
37
37
public CloudMusicLyricsToolPageViewModel()
38
38
{
39
_ = Task.WhenAll(new List<Task>
39
Console.WriteLine("准备启动网易云后台线程");
40
Task.Run(async () =>
40
41
{
41
Task.Run(async () =>
42
try
42
43
{
43
44
Console.WriteLine("正在搜索花再设备...");
44
45
while (!DeviceReady)
45
46
{
46
47
var ready = Device.Initialize();
47
48
AutoNavigationParameterService.CurrentPage?.DispatcherQueue.TryEnqueue(() =>
48
{
49
DeviceReady = ready;
50
});
49
{
50
DeviceReady = ready;
51
});
51
52
await Task.Delay(500);
52
53
}
53
54
Console.WriteLine("花再设备已连接");
54
}),
55
Task.Run(async () =>
55
}
56
catch (Exception ex)
57
{
58
Console.WriteLine($"[ERROR]搜索花再设备时发生错误:{ex.Message}");
59
Console.WriteLine($"[TRACE]{ex.StackTrace}");
60
}
61
62
});
63
Task.Run(async () =>
64
{
65
try
56
66
{
57
67
Console.WriteLine("正在搜索云音乐...");
58
68
while (!CloudMusicReady)
@@ -66,83 +76,99 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
66
76
await Task.Delay(500);
67
77
}
68
78
Console.WriteLine("云音乐已准备就绪");
69
}),
70
Task.Run(async () =>
79
}
80
catch (Exception ex)
71
81
{
72
while (true)
82
Console.WriteLine($"[ERROR]搜索云音乐时发生错误:{ex.Message}");
83
Console.WriteLine($"[TRACE]{ex.StackTrace}");
84
}
85
});
86
Task.Run(async () =>
87
{
88
Console.WriteLine("启动云音乐地址重解析线程");
89
while (true)
90
{
91
try
73
92
{
74
93
Reader.ReresolveAddress();
75
94
await Task.Delay(500);
76
95
}
77
}),
78
Task.Run(async () =>
96
catch (Exception ex)
97
{
98
Console.WriteLine($"[ERROR]云音乐地址重解析线程发生错误:{ex.Message}");
99
Console.WriteLine($"[TRACE]{ex.StackTrace}");
100
}
101
}
102
});
103
Task.Run(async () =>
104
{
105
Console.WriteLine("启动网易云歌词主线程");
106
while (true)
79
107
{
80
while (true)
108
bool isClockUI = false;
109
int time = 0;
110
try
81
111
{
82
bool isClockUI = false;
83
int time = 0;
84
try
112
if (DeviceReady && CloudMusicReady && EnableCloudMusicLyrics)
85
113
{
86
if (DeviceReady && CloudMusicReady && EnableCloudMusicLyrics)
114
Console.WriteLine("[DEBUG]设备均在线,准备进入主循环");
115
string lastRead = string.Empty;
116
bool scrolled = false;
117
while (true)
87
118
{
88
Console.WriteLine("[DEBUG]设备均在线,准备进入主循环");
89
string lastRead = string.Empty;
90
bool scrolled = false;
91
while (true)
119
try
92
120
{
93
try
121
if (!DeviceReady || !CloudMusicReady || !EnableCloudMusicLyrics)
122
break;
123
if (Reader.TryReadLyrics(out var lyrics) && lastRead != lyrics)
94
124
{
95
if (!DeviceReady || !CloudMusicReady || !EnableCloudMusicLyrics)
96
break;
97
if (Reader.TryReadLyrics(out var lyrics) && lastRead != lyrics)
125
Console.WriteLine($"已读取到歌词:{lyrics}");
126
lastRead = lyrics;
127
isClockUI = false;
128
time = 0;
129
if (scrolled)
98
130
{
99
Console.WriteLine($"已读取到歌词:{lyrics}");
100
lastRead = lyrics;
101
isClockUI = false;
102
time = 0;
103
if (scrolled)
104
{
105
Device.ShowText(string.Empty);
106
await Task.Delay(100);
107
scrolled = false;
108
}
109
Device.SetTextLayout(CloudMusicLyricsProfile.DefaultHaloPixelTextLayout);
110
Device.ShowText(lyrics);
111
Debug.WriteLine(lyrics.DisplayLength());
112
if (lyrics.DisplayLength() > 30)
113
{
114
scrolled = true;
115
await Task.Delay(500);
116
Device.SetTextLayout(Core.Models.HaloPixelTextLayout.ScrollRightToLeft);
117
}
131
Device.ShowText(string.Empty);
132
await Task.Delay(100);
133
scrolled = false;
118
134
}
119
await Task.Delay(50);
120
time += 50;
121
if (!isClockUI && time >= CloudMusicLyricsProfile.SwitchBackTimeout * 1000)
135
Device.SetTextLayout(CloudMusicLyricsProfile.DefaultHaloPixelTextLayout);
136
Device.ShowText(lyrics);
137
Debug.WriteLine(lyrics.DisplayLength());
138
if (lyrics.DisplayLength() > 30)
122
139
{
123
isClockUI = true;
124
Device.SetUIModel(CloudMusicLyricsProfile.DefaultHaloPixelUIModel);
125
Console.WriteLine("已切换至时钟界面");
140
scrolled = true;
141
await Task.Delay(500);
142
Device.SetTextLayout(Core.Models.HaloPixelTextLayout.ScrollRightToLeft);
126
143
}
127
144
}
128
catch(Exception ex)
145
await Task.Delay(50);
146
time += 50;
147
if (!isClockUI && time >= CloudMusicLyricsProfile.SwitchBackTimeout * 1000)
129
148
{
130
Console.WriteLine($"[ERROR]{ex.Message}");
131
Console.WriteLine($"[TRACE]{ex.StackTrace}");
149
isClockUI = true;
150
Device.SetUIModel(CloudMusicLyricsProfile.DefaultHaloPixelUIModel);
151
Console.WriteLine("已切换至时钟界面");
132
152
}
133
153
}
134
Console.WriteLine($"[DEBUG]主循环已退出");
154
catch (Exception ex)
155
{
156
Console.WriteLine($"[ERROR]网易云歌词主循环发生错误:{ex.Message}");
157
Console.WriteLine($"[TRACE]{ex.StackTrace}");
158
}
135
159
}
136
Console.WriteLine($"[DEBUG]状态\t音响:{DeviceReady} 软件:{CloudMusicReady} 启用状态:{EnableCloudMusicLyrics}");
137
await Task.Delay(500);
138
}
139
catch (Exception ex)
140
{
141
Console.WriteLine($"[ERROR]{ex.Message}");
142
Console.WriteLine($"[TRACE]{ex.StackTrace}");
160
Console.WriteLine($"[DEBUG]主循环已退出");
143
161
}
162
Console.WriteLine($"[DEBUG]状态\t音响:{DeviceReady} 软件:{CloudMusicReady} 启用状态:{EnableCloudMusicLyrics}");
163
await Task.Delay(500);
164
}
165
catch (Exception ex)
166
{
167
Console.WriteLine($"[ERROR]网易云歌词主线程发生错误:{ex.Message}");
168
Console.WriteLine($"[TRACE]{ex.StackTrace}");
144
169
}
145
})
170
}
146
171
});
172
Console.WriteLine("网易云后台线程启动完成");
147
173
}
148
174
}
@@ -1,6 +1,7 @@
1
1
using CommunityToolkit.Mvvm.ComponentModel;
2
2
using CommunityToolkit.Mvvm.Input;
3
3
using HaloPixelToolBox.Core.Utilities.Helpers;
4
using HaloPixelToolBox.Interface.Services;
4
5
using HaloPixelToolBox.Profiles.CrossVersionProfiles;
5
6
using HaloPixelToolBox.Utilities;
6
7
using Microsoft.Win32;
@@ -17,7 +18,7 @@ public partial class SettingPageViewModel : ViewModelBase
17
18
[ObservableProperty]
18
19
bool isAutoStartEnable = SystemProfile.AutoStart;
19
20
[ObservableProperty]
20
private bool minimizeWhenOpen = SystemProfile.MinimizeWhenOpen;
21
private bool minimizeWhenOpen = SystemProfile.MinimizeWhenOpen;
21
22
[ObservableProperty]
22
23
string appCacheDirectory = AppPathHelper.AppCache;
23
24
[ObservableProperty]
@@ -32,6 +33,8 @@ public partial class SettingPageViewModel : ViewModelBase
32
33
string appLogSize = FileHelper.GetDirectorySize(new(AppPath.LogDictionary)).FileSize();
33
34
[ObservableProperty]
34
35
private string currentVersion = Assembly.GetEntryAssembly()?.GetName().Version is Version version ? version.ToString(3) : "无法获取版本信息";
36
[ObservableProperty]
37
private string ignoreVersion = SystemProfile.IgnoreVersion;
35
38
public ISettingService SettingService { get; set; } = ServiceManager.GetService<ISettingService>();
36
39
public IDialogService DialogService { get; set; } = ServiceManager.GetService<IDialogService>();
37
40
@@ -41,6 +44,8 @@ public partial class SettingPageViewModel : ViewModelBase
41
44
SetAutoStart(value);
42
45
}
43
46
47
partial void OnIgnoreVersionChanged(string value) => SystemProfile.IgnoreVersion = value;
48
44
49
partial void OnMinimizeWhenOpenChanged(bool value) => SystemProfile.MinimizeWhenOpen = value;
45
50
46
51
private static void SetAutoStart(bool enable) => SetAutoStart(enable, Assembly.GetExecutingAssembly().GetName().Name ?? "HaloPixelToolBox");
@@ -77,4 +82,10 @@ public partial class SettingPageViewModel : ViewModelBase
77
82
AppCacheSize = FileHelper.GetDirectorySize(new(AppPathHelper.AppCache)).FileSize();
78
83
}
79
84
}
85
86
[RelayCommand]
87
void ClearIgnoreVersion() => IgnoreVersion = string.Empty;
88
89
[RelayCommand]
90
static async Task CheckUpgrade() => await ServiceManager.GetGlobalService<IUpgradeService>()!.CheckUpgrade();
80
91
}
@@ -42,7 +42,7 @@
42
42
<Border CornerRadius="90" Height="25" Width="25" Visibility="{x:Bind ViewModel.CloudMusicReady, Mode=OneWay}" Background="{ThemeResource SystemFillColorSuccessBrush}"/>
43
43
</Grid>
44
44
</Grid>
45
<TextBlock Text="网易云版本 (当前支持版本3.1.25)" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
45
<TextBlock Text="网易云版本 (当前支持版本3.1.26)" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
46
46
<TextBlock Text="{x:Bind ViewModel.CloudMusicVersion, Mode=OneWay}" Style="{StaticResource BodyTextBlockStyle}"/>
47
47
<TextBlock Text="启用状态" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
48
48
<controls:SettingsCard Header="启用歌词同步" Description="启用后,网易云的歌词会实时显示在花再 Halo Pixel 音响上">
@@ -13,6 +13,7 @@ public sealed partial class CloudMusicLyricsToolPage : Page
13
13
public CloudMusicLyricsToolPageViewModel ViewModel { get; set; } = new();
14
14
public CloudMusicLyricsToolPage()
15
15
{
16
Console.WriteLine("�����Ƹ�ʹ���ҳ���ʼ����...");
16
17
Current = this;
17
18
InitializeComponent();
18
19
ViewModel.AutoNavigationParameterService.Initialize(this);
@@ -21,10 +22,12 @@ public sealed partial class CloudMusicLyricsToolPage : Page
21
22
ViewModel.SettingService.Initialize();
22
23
ViewModel.SettingService.RegisterEvents();
23
24
NavigationCacheMode = NavigationCacheMode.Enabled;
25
Console.WriteLine("�����Ƹ�ʹ���ҳ���ʼ�����");
24
26
}
25
27
26
28
protected override void OnNavigatedTo(NavigationEventArgs e)
27
29
{
30
Console.WriteLine("�����������Ƹ�ʹ���ҳ��");
28
31
ViewModel.AutoNavigationParameterService.OnParameterChange(e.Parameter);
29
32
}
30
33
}