From c9df8613282a000bf726bef18914f07d1700525c Mon Sep 17 00:00:00 2001 From: mujianwu Date: Wed, 24 Jul 2024 22:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BE=9D=E8=B5=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=89=88=E6=9C=AC=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UotanToolbox/Features/Home/HomeViewModel.cs | 2 -- UotanToolbox/Features/Settings/SettingsView.axaml | 4 ++-- UotanToolbox/Features/Settings/SettingsViewModel.cs | 8 ++++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/UotanToolbox/Features/Home/HomeViewModel.cs b/UotanToolbox/Features/Home/HomeViewModel.cs index ffd83cda..86c98f82 100644 --- a/UotanToolbox/Features/Home/HomeViewModel.cs +++ b/UotanToolbox/Features/Home/HomeViewModel.cs @@ -75,8 +75,6 @@ await Dispatcher.UIThread.InvokeAsync(async () => Process.GetCurrentProcess().Kill(); }); } - Global.BinVersion = await StringHelper.GetBinVersion(); - } public async Task GetDevicesList() diff --git a/UotanToolbox/Features/Settings/SettingsView.axaml b/UotanToolbox/Features/Settings/SettingsView.axaml index 06acd325..d86fff41 100644 --- a/UotanToolbox/Features/Settings/SettingsView.axaml +++ b/UotanToolbox/Features/Settings/SettingsView.axaml @@ -9,7 +9,7 @@ xmlns:settings="clr-namespace:UotanToolbox.Features.Settings" xmlns:suki="clr-namespace:SukiUI.Controls;assembly=SukiUI" xmlns:assets="clr-namespace:UotanToolbox.Assets;assembly=UotanToolbox" - d:DesignHeight="1950" + d:DesignHeight="2950" d:DesignWidth="1024" x:DataType="settings:SettingsViewModel" mc:Ignorable="d"> @@ -268,7 +268,7 @@ QCNTool (from Github repo https://github.com/MindowsToolBox/QCNTool) QMSL_MSVC10R.dll (from QPST) Suki UI (modified from Github repo https://github.com/kikipoulet/SukiUI) - BinVersion: + diff --git a/UotanToolbox/Features/Settings/SettingsViewModel.cs b/UotanToolbox/Features/Settings/SettingsViewModel.cs index 12d2b321..5604b44b 100644 --- a/UotanToolbox/Features/Settings/SettingsViewModel.cs +++ b/UotanToolbox/Features/Settings/SettingsViewModel.cs @@ -1,5 +1,6 @@ using Avalonia.Collections; using Avalonia.Styling; +using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Material.Icons; @@ -35,12 +36,14 @@ public partial class SettingsViewModel : MainPageBase [ObservableProperty] private bool _backgroundAnimations; [ObservableProperty] private bool _backgroundTransitions; [ObservableProperty] private string _currentVersion = Global.currentVersion; + [ObservableProperty] private string _binVersion = null; private string _customShader = null; private static string GetTranslation(string key) => FeaturesHelper.GetTranslation(key); public SettingsViewModel() : base(GetTranslation("Sidebar_Settings"), MaterialIconKind.SettingsOutline, -200) { + _ = CheckBinVersion(); AvailableBackgroundStyles = new AvaloniaList(Enum.GetValues()); AvailableColors = _theme.ColorThemes; IsLightTheme = _theme.ActiveBaseTheme == ThemeVariant.Light; @@ -52,6 +55,11 @@ public SettingsViewModel() : base(GetTranslation("Sidebar_Settings"), MaterialIc }; } + public async Task CheckBinVersion() + { + BinVersion = await StringHelper.GetBinVersion(); + } + partial void OnIsLightThemeChanged(bool value) => _theme.ChangeBaseTheme(value ? ThemeVariant.Light : ThemeVariant.Dark);