From e04769ea7c35eebfa40bd3836a4aebb2d8709811 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Sun, 15 Oct 2023 23:31:22 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/UI/SettingsViewModel.cs | 19 +++++++++---------- .../VersionUpdateSettingsUserControl.xaml.cs | 5 +++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 8242c4e221..4b83a541ff 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -72,24 +72,22 @@ namespace MaaWpfGui.ViewModels.UI [DllImport("user32.dll")] private static extern bool IsIconic(IntPtr hWnd); - private static readonly string _coreVersion = Marshal.PtrToStringAnsi(AsstGetVersion()); - /// /// Gets the core version. /// - public string CoreVersion => _coreVersion; + public static string CoreVersion { get => Marshal.PtrToStringAnsi(AsstGetVersion()); } private static readonly string _uiVersion = FileVersionInfo.GetVersionInfo(Application.ResourceAssembly.Location).ProductVersion.Split('+')[0]; /// /// Gets the UI version. /// - public string UiVersion => _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; + public static string UiVersion { get => _uiVersion == "0.0.1" ? "DEBUG VERSION" : _uiVersion; } /// /// The Pallas language key. /// - public static readonly string PallasLangKey = "pallas"; + public const string PallasLangKey = "pallas"; /// /// Gets the visibility of task setting views. @@ -841,7 +839,7 @@ namespace MaaWpfGui.ViewModels.UI { fixed (char* ptr = buf) { - link.GetPath(ptr, 260, IntPtr.Zero, 0); // MAX_PATH + link.GetPath(ptr, 260, IntPtr.Zero, 0); // MAX_PATH var len = Array.IndexOf(buf, '\0'); if (len != -1) { @@ -1620,8 +1618,8 @@ namespace MaaWpfGui.ViewModels.UI // 根据出当前 ScrollOffset 选出最后一个在可视范围的 Divider 索引 var dividerSelect = DividerVerticalOffsetList.Select((n, i) => ( - dividerAppeared: value >= n, - index: i)); + dividerAppeared: value >= n, + index: i)); var index = dividerSelect.LastOrDefault(n => n.dividerAppeared).index; SelectedIndex = index; @@ -2403,7 +2401,7 @@ namespace MaaWpfGui.ViewModels.UI /* 软件更新设置 */ private UpdateVersionType _versionType = (UpdateVersionType)Enum.Parse(typeof(UpdateVersionType), - ConfigurationHelper.GetValue(ConfigurationKeys.VersionType, UpdateVersionType.Stable.ToString())); + ConfigurationHelper.GetValue(ConfigurationKeys.VersionType, UpdateVersionType.Stable.ToString())); /// /// Gets or sets the type of version to update. @@ -3407,7 +3405,8 @@ namespace MaaWpfGui.ViewModels.UI private InverseClearType _inverseClearMode = Enum.TryParse(ConfigurationHelper.GetValue(ConfigurationKeys.InverseClearMode, InverseClearType.Clear.ToString()), out InverseClearType temp) - ? temp : InverseClearType.Clear; + ? temp + : InverseClearType.Clear; /// /// Gets or sets the inverse clear mode. diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs index 76436a5221..b1aa920703 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml.cs @@ -19,6 +19,7 @@ using System.Windows.Threading; using HandyControl.Controls; using HandyControl.Data; using MaaWpfGui.Helper; +using MaaWpfGui.ViewModels.UI; namespace MaaWpfGui.Views.UserControl { @@ -45,7 +46,7 @@ namespace MaaWpfGui.Views.UserControl { try { - CopyToClipboardAsync(Instances.SettingsViewModel.CoreVersion); + CopyToClipboardAsync(SettingsViewModel.CoreVersion); } catch { @@ -59,7 +60,7 @@ namespace MaaWpfGui.Views.UserControl { try { - CopyToClipboardAsync(Instances.SettingsViewModel.UiVersion); + CopyToClipboardAsync(SettingsViewModel.UiVersion); } catch {