From af27e95fdc90aa886edabfe054bba8ccd26e4ad3 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:58:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=9A=E9=85=8D=E7=BD=AE=E4=B8=8B?= =?UTF-8?q?=E5=85=AC=E5=91=8A=E5=92=8C=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/UI/AnnouncementViewModel.cs | 12 +++++------ .../ViewModels/UI/VersionUpdateViewModel.cs | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/AnnouncementViewModel.cs b/src/MaaWpfGui/ViewModels/UI/AnnouncementViewModel.cs index eeeb6ee553..0fb1e3ccb1 100644 --- a/src/MaaWpfGui/ViewModels/UI/AnnouncementViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/AnnouncementViewModel.cs @@ -26,7 +26,7 @@ namespace MaaWpfGui.ViewModels.UI // ReSharper disable once ClassNeverInstantiated.Global public class AnnouncementViewModel : Screen { - private string _announcementInfo = ConfigurationHelper.GetValue(ConfigurationKeys.AnnouncementInfo, string.Empty); + private string _announcementInfo = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.AnnouncementInfo, string.Empty); /// /// Gets the announcement info. @@ -38,11 +38,11 @@ namespace MaaWpfGui.ViewModels.UI private set { SetAndNotify(ref _announcementInfo, value); - ConfigurationHelper.SetValue(ConfigurationKeys.AnnouncementInfo, value); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.AnnouncementInfo, value); } } - private bool _doNotRemindThisAnnouncementAgain = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.DoNotRemindThisAnnouncementAgain, bool.FalseString)); + private bool _doNotRemindThisAnnouncementAgain = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.DoNotRemindThisAnnouncementAgain, bool.FalseString)); public bool DoNotRemindThisAnnouncementAgain { @@ -50,11 +50,11 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _doNotRemindThisAnnouncementAgain, value); - ConfigurationHelper.SetValue(ConfigurationKeys.DoNotRemindThisAnnouncementAgain, value.ToString()); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.DoNotRemindThisAnnouncementAgain, value.ToString()); } } - private bool _doNotShowAnnouncement = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.DoNotShowAnnouncement, bool.FalseString)); + private bool _doNotShowAnnouncement = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.DoNotShowAnnouncement, bool.FalseString)); /// /// Gets or sets a value indicating whether to show the update. @@ -65,7 +65,7 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _doNotShowAnnouncement, value); - ConfigurationHelper.SetValue(ConfigurationKeys.DoNotShowAnnouncement, value.ToString()); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.DoNotShowAnnouncement, value.ToString()); } } diff --git a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs index 78eceb9b1f..3655ec5c5e 100644 --- a/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/VersionUpdateViewModel.cs @@ -68,7 +68,7 @@ namespace MaaWpfGui.ViewModels.UI private readonly string _curVersion = Marshal.PtrToStringAnsi(MaaService.AsstGetVersion()) ?? "0.0.1"; private string _latestVersion = string.Empty; - private string _updateTag = ConfigurationHelper.GetValue(ConfigurationKeys.VersionName, string.Empty); + private string _updateTag = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.VersionName, string.Empty); /// /// Gets or sets the update tag. @@ -79,11 +79,11 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _updateTag, value); - ConfigurationHelper.SetValue(ConfigurationKeys.VersionName, value); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.VersionName, value); } } - private string _updateInfo = ConfigurationHelper.GetValue(ConfigurationKeys.VersionUpdateBody, string.Empty); + private string _updateInfo = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.VersionUpdateBody, string.Empty); // private static readonly MarkdownPipeline s_markdownPipeline = new MarkdownPipelineBuilder().UseXamlSupportedExtensions().Build(); @@ -107,7 +107,7 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _updateInfo, value); - ConfigurationHelper.SetValue(ConfigurationKeys.VersionUpdateBody, value); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.VersionUpdateBody, value); } } @@ -122,7 +122,7 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _updateUrl, value); } - private bool _isFirstBootAfterUpdate = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.VersionUpdateIsFirstBoot, bool.FalseString)); + private bool _isFirstBootAfterUpdate = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.VersionUpdateIsFirstBoot, bool.FalseString)); /// /// Gets or sets a value indicating whether it is the first boot after updating. @@ -133,11 +133,11 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _isFirstBootAfterUpdate, value); - ConfigurationHelper.SetValue(ConfigurationKeys.VersionUpdateIsFirstBoot, value.ToString()); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.VersionUpdateIsFirstBoot, value.ToString()); } } - private string _updatePackageName = ConfigurationHelper.GetValue(ConfigurationKeys.VersionUpdatePackage, string.Empty); + private string _updatePackageName = ConfigurationHelper.GetGlobalValue(ConfigurationKeys.VersionUpdatePackage, string.Empty); /// /// Gets or sets the name of the update package. @@ -148,7 +148,7 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _updatePackageName, value); - ConfigurationHelper.SetValue(ConfigurationKeys.VersionUpdatePackage, value); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.VersionUpdatePackage, value); } } @@ -421,7 +421,7 @@ namespace MaaWpfGui.ViewModels.UI Native, } - private bool _doNotShowUpdate = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, bool.FalseString)); + private bool _doNotShowUpdate = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, bool.FalseString)); /// /// Gets or sets a value indicating whether to show the update. @@ -432,7 +432,7 @@ namespace MaaWpfGui.ViewModels.UI set { SetAndNotify(ref _doNotShowUpdate, value); - ConfigurationHelper.SetValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, value.ToString()); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.VersionUpdateDoNotShowUpdate, value.ToString()); } }