diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 972f14df64..a0cd0985a0 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -37,19 +37,16 @@ using MaaWpfGui.Helper; using MaaWpfGui.Main; using MaaWpfGui.Models; using MaaWpfGui.Services.HotKeys; -using MaaWpfGui.Services.Notification; using MaaWpfGui.Services.RemoteControl; using MaaWpfGui.States; using MaaWpfGui.Utilities; using MaaWpfGui.Utilities.ValueType; -using MaaWpfGui.ViewModels.UserControl; using MaaWpfGui.ViewModels.UserControl.Settings; using Microsoft.Win32; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; using Stylet; -using static MaaWpfGui.ViewModels.UserControl.VersionUpdateSettingsUserControlModel; using ComboBox = System.Windows.Controls.ComboBox; using DarkModeType = MaaWpfGui.Configuration.GUI.DarkModeType; using Timer = System.Timers.Timer; @@ -262,9 +259,9 @@ namespace MaaWpfGui.ViewModels.UI private void InitVersionUpdate() { - if (VersionUpdateDataContext.VersionType == UpdateVersionType.Nightly && !VersionUpdateDataContext.AllowNightlyUpdates) + if (VersionUpdateDataContext.VersionType == VersionUpdateSettingsUserControlModel.UpdateVersionType.Nightly && !VersionUpdateDataContext.AllowNightlyUpdates) { - VersionUpdateDataContext.VersionType = UpdateVersionType.Beta; + VersionUpdateDataContext.VersionType = VersionUpdateSettingsUserControlModel.UpdateVersionType.Beta; } } @@ -1125,7 +1122,7 @@ namespace MaaWpfGui.ViewModels.UI { SetAndNotify(ref _clientType, value); ConfigurationHelper.SetValue(ConfigurationKeys.ClientType, value); - VersionUpdateDataContext.ResourceInfo = GetResourceVersionByClientType(_clientType); + VersionUpdateDataContext.ResourceInfo = VersionUpdateSettingsUserControlModel.GetResourceVersionByClientType(_clientType); VersionUpdateDataContext.ResourceVersion = VersionUpdateDataContext.ResourceInfo.VersionName; VersionUpdateDataContext.ResourceDateTime = VersionUpdateDataContext.ResourceInfo.DateTime; UpdateWindowTitle(); // 每次修改客户端时更新WindowTitle @@ -4159,7 +4156,7 @@ namespace MaaWpfGui.ViewModels.UI _ => $" - {VersionUpdateDataContext.ResourceDateTime.ToString(LocalizationHelper.CustomCultureInfo.DateTimeFormat.ShortDatePattern.Replace("yyyy", string.Empty).Trim('/', '.'))} {VersionUpdateDataContext.ResourceVersion}", } : string.Empty; - rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}"; + rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {VersionUpdateSettingsUserControlModel.CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}"; } } } diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index 2de7245e24..35486c53b3 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -33,7 +33,7 @@ using MaaWpfGui.Services; using MaaWpfGui.States; using MaaWpfGui.Utilities; using MaaWpfGui.Utilities.ValueType; -using MaaWpfGui.ViewModels.UserControl; +using MaaWpfGui.ViewModels.UserControl.Settings; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; diff --git a/src/MaaWpfGui/ViewModels/UserControl/ExternalNotificationSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs similarity index 99% rename from src/MaaWpfGui/ViewModels/UserControl/ExternalNotificationSettingsUserControlModel.cs rename to src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs index 580d58aa49..d51b07f762 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/ExternalNotificationSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/ExternalNotificationSettingsUserControlModel.cs @@ -20,7 +20,7 @@ using MaaWpfGui.Helper; using MaaWpfGui.Services.Notification; using Stylet; -namespace MaaWpfGui.ViewModels.UserControl; +namespace MaaWpfGui.ViewModels.UserControl.Settings; /// /// 外部通知 diff --git a/src/MaaWpfGui/ViewModels/UserControl/VersionUpdateSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs similarity index 97% rename from src/MaaWpfGui/ViewModels/UserControl/VersionUpdateSettingsUserControlModel.cs rename to src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs index 0f8f9f4cec..0ab5d19805 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/VersionUpdateSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/VersionUpdateSettingsUserControlModel.cs @@ -34,7 +34,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Stylet; -namespace MaaWpfGui.ViewModels.UserControl; +namespace MaaWpfGui.ViewModels.UserControl.Settings; /// /// 软件更新设置 @@ -112,7 +112,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase { const string OfficialClientType = "Official"; const string BilibiliClientType = "Bilibili"; - string jsonPath = "resource/version.json"; + var jsonPath = "resource/version.json"; if (clientType is not ("" or OfficialClientType or BilibiliClientType)) { jsonPath = $"resource/global/{clientType}/resource/version.json"; @@ -133,15 +133,15 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase ? DateTime.MinValue : DateTime.ParseExact(lastUpdated, "yyyy-MM-dd HH:mm:ss.fff", null); - if ((currentTime < poolTime) && (currentTime < activityTime)) + if (currentTime < poolTime && currentTime < activityTime) { versionName = string.Empty; } - else if ((currentTime >= poolTime) && (currentTime < activityTime)) + else if (currentTime >= poolTime && currentTime < activityTime) { versionName = versionJson?["gacha"]?["pool"]?.ToString() ?? string.Empty; } - else if ((currentTime < poolTime) && (currentTime >= activityTime)) + else if (currentTime < poolTime && currentTime >= activityTime) { versionName = versionJson?["activity"]?["name"]?.ToString() ?? string.Empty; } @@ -334,7 +334,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase { var ret = await Instances.VersionUpdateViewModel.CheckAndDownloadUpdate(); - string toastMessage = string.Empty; + var toastMessage = string.Empty; switch (ret) { case VersionUpdateViewModel.CheckUpdateRetT.NoNeedToUpdate: diff --git a/src/MaaWpfGui/Views/UI/SettingsView.xaml b/src/MaaWpfGui/Views/UI/SettingsView.xaml index 0364a8f074..39334d82c1 100644 --- a/src/MaaWpfGui/Views/UI/SettingsView.xaml +++ b/src/MaaWpfGui/Views/UI/SettingsView.xaml @@ -78,7 +78,7 @@ - @@ -87,7 +87,7 @@ - diff --git a/src/MaaWpfGui/Views/UserControl/ExternalNotificationSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/Settings/ExternalNotificationSettingsUserControl.xaml similarity index 99% rename from src/MaaWpfGui/Views/UserControl/ExternalNotificationSettingsUserControl.xaml rename to src/MaaWpfGui/Views/UserControl/Settings/ExternalNotificationSettingsUserControl.xaml index d5a1557216..b5480e56b3 100644 --- a/src/MaaWpfGui/Views/UserControl/ExternalNotificationSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/Settings/ExternalNotificationSettingsUserControl.xaml @@ -1,5 +1,5 @@ -namespace MaaWpfGui.Views.UserControl +namespace MaaWpfGui.Views.UserControl.Settings { /// /// ExternalNotificationSettingsUserControl.xaml 的交互逻辑 diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml similarity index 99% rename from src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml rename to src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml index 4094fc0ac9..6bf8310fa6 100644 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/Settings/VersionUpdateSettingsUserControl.xaml @@ -1,5 +1,5 @@ /// VersionUpdateSettingsUserControl.xaml 的交互逻辑 @@ -80,7 +80,7 @@ namespace MaaWpfGui.Views.UserControl try { - Thread clipboardThread = new Thread(() => + var clipboardThread = new Thread(() => { try {