fix: 多配置下公告和更新日志显示异常

This commit is contained in:
uye
2024-08-20 15:58:57 +08:00
parent d539d26ac8
commit af27e95fdc
2 changed files with 16 additions and 16 deletions

View File

@@ -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);
/// <summary>
/// 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));
/// <summary>
/// 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());
}
}

View File

@@ -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);
/// <summary>
/// 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));
/// <summary>
/// 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);
/// <summary>
/// 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));
/// <summary>
/// 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());
}
}