diff --git a/src/Starward.Language/Lang.Designer.cs b/src/Starward.Language/Lang.Designer.cs
index c9e0a9266..a2816bc97 100644
--- a/src/Starward.Language/Lang.Designer.cs
+++ b/src/Starward.Language/Lang.Designer.cs
@@ -736,6 +736,15 @@ public static string ExperienceSettingPage_CloseWindowOption {
}
}
+ ///
+ /// 查找类似 Disable red dot reminder for game notices 的本地化字符串。
+ ///
+ public static string ExperienceSettingPage_DisableRedDotReminderForGameNotices {
+ get {
+ return ResourceManager.GetString("ExperienceSettingPage_DisableRedDotReminderForGameNotices", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Exit completely 的本地化字符串。
///
@@ -745,6 +754,24 @@ public static string ExperienceSettingPage_ExitCompletely {
}
}
+ ///
+ /// 查找类似 Features 的本地化字符串。
+ ///
+ public static string ExperienceSettingPage_Features {
+ get {
+ return ResourceManager.GetString("ExperienceSettingPage_Features", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Hide game account switcher 的本地化字符串。
+ ///
+ public static string ExperienceSettingPage_HideGameAccountSwitcher {
+ get {
+ return ResourceManager.GetString("ExperienceSettingPage_HideGameAccountSwitcher", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Minimize to system tray 的本地化字符串。
///
diff --git a/src/Starward.Language/Lang.resx b/src/Starward.Language/Lang.resx
index eda637ff5..74600415c 100644
--- a/src/Starward.Language/Lang.resx
+++ b/src/Starward.Language/Lang.resx
@@ -1235,4 +1235,13 @@ Do you accept the risk and continue to use it?
Always display navigation sidebar icons
+
+ Features
+
+
+ Hide game account switcher
+
+
+ Disable red dot reminder for game notices
+
\ No newline at end of file
diff --git a/src/Starward.Language/Lang.zh-CN.resx b/src/Starward.Language/Lang.zh-CN.resx
index 2bf0d7498..df763c941 100644
--- a/src/Starward.Language/Lang.zh-CN.resx
+++ b/src/Starward.Language/Lang.zh-CN.resx
@@ -1234,4 +1234,13 @@
始终显示导航侧栏图标
+
+ 功能
+
+
+ 隐藏游戏账号切换器
+
+
+ 禁用游戏通知的红点提醒
+
\ No newline at end of file
diff --git a/src/Starward/AppConfig.cs b/src/Starward/AppConfig.cs
index 5a867456f..c48dab80c 100644
--- a/src/Starward/AppConfig.cs
+++ b/src/Starward/AppConfig.cs
@@ -108,15 +108,6 @@ public static string UserDataFolder
}
- public static bool DisableNavigationShortcut { get; set; }
-
- public static bool DisableGameNoticeRedHot { get; set; }
-
- public static bool DisableGameAccountSwitcher { get; set; }
-
- public static bool EnableSystemAccentColor { get; set; }
-
-
private static void Initialize()
@@ -148,11 +139,6 @@ private static void Initialize()
windowSizeMode = Configuration.GetValue(nameof(WindowSizeMode));
language = Configuration.GetValue(nameof(Language));
- //DisableNavigationShortcut = Configuration.GetValue(nameof(DisableNavigationShortcut));
- //DisableGameNoticeRedHot = Configuration.GetValue(nameof(DisableGameNoticeRedHot));
- //DisableGameAccountSwitcher = Configuration.GetValue(nameof(DisableGameAccountSwitcher));
- //EnableSystemAccentColor = Configuration.GetValue(nameof(EnableSystemAccentColor));
- //EnableNavigationViewLeftCompact = Configuration.GetValue(nameof(EnableNavigationViewLeftCompact), true);
string? dir = Configuration.GetValue(nameof(UserDataFolder));
if (!string.IsNullOrWhiteSpace(dir))
{
@@ -201,11 +187,6 @@ private static void SaveConfiguration()
{nameof(WindowSizeMode)}={WindowSizeMode}
{nameof(Language)}={Language}
{nameof(UserDataFolder)}={dataFolder}
- {nameof(DisableNavigationShortcut)}={DisableNavigationShortcut}
- {nameof(DisableGameNoticeRedHot)}={DisableGameNoticeRedHot}
- {nameof(DisableGameAccountSwitcher)}={DisableGameAccountSwitcher}
- {nameof(EnableSystemAccentColor)}={EnableSystemAccentColor}
- {nameof(EnableNavigationViewLeftCompact)}={EnableNavigationViewLeftCompact}
""");
}
catch { }
@@ -434,6 +415,20 @@ public static bool EnableNavigationViewLeftCompact
}
+ public static bool DisableGameAccountSwitcher
+ {
+ get => GetValue();
+ set => SetValue(value);
+ }
+
+
+ public static bool DisableGameNoticeRedHot
+ {
+ get => GetValue();
+ set => SetValue(value);
+ }
+
+
#endregion
diff --git a/src/Starward/Messages/GameAccountSwitcherDisabledChanged.cs b/src/Starward/Messages/GameAccountSwitcherDisabledChanged.cs
new file mode 100644
index 000000000..bf8ce4bcd
--- /dev/null
+++ b/src/Starward/Messages/GameAccountSwitcherDisabledChanged.cs
@@ -0,0 +1,4 @@
+namespace Starward.Messages;
+
+public record GameAccountSwitcherDisabledChanged(bool IsDisabled);
+
diff --git a/src/Starward/Messages/GameNoticeRedHotDisabledChanged.cs b/src/Starward/Messages/GameNoticeRedHotDisabledChanged.cs
new file mode 100644
index 000000000..57231d8b2
--- /dev/null
+++ b/src/Starward/Messages/GameNoticeRedHotDisabledChanged.cs
@@ -0,0 +1,4 @@
+namespace Starward.Messages;
+
+public record GameNoticeRedHotDisabledChanged(bool IsDisabled);
+
diff --git a/src/Starward/Pages/LauncherPage.xaml.cs b/src/Starward/Pages/LauncherPage.xaml.cs
index 114f07fa3..0309558a1 100644
--- a/src/Starward/Pages/LauncherPage.xaml.cs
+++ b/src/Starward/Pages/LauncherPage.xaml.cs
@@ -3,6 +3,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.Logging;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
@@ -14,6 +15,7 @@
using Starward.Core;
using Starward.Core.Launcher;
using Starward.Helpers;
+using Starward.Messages;
using Starward.Models;
using Starward.Services;
using System;
@@ -79,6 +81,13 @@ public LauncherPage()
_timer.Interval = TimeSpan.FromSeconds(5);
_timer.IsRepeating = true;
_timer.Tick += _timer_Tick;
+
+ WeakReferenceMessenger.Default.Register(this, (_, _) =>
+ {
+ GetGameAccount();
+ _ = GetGameNoticesAlertAsync();
+ });
+ WeakReferenceMessenger.Default.Register(this, (_, _) => _ = GetGameNoticesAlertAsync());
}
@@ -117,6 +126,7 @@ private void Page_Unloaded(object sender, RoutedEventArgs e)
{
_timer.Stop();
GameProcess?.Dispose();
+ WeakReferenceMessenger.Default.UnregisterAll(this);
}
@@ -278,6 +288,7 @@ private async Task GetGameNoticesAlertAsync()
{
if (AppConfig.DisableGameNoticeRedHot || AppConfig.DisableGameAccountSwitcher)
{
+ Image_GameNoticesAlert.Visibility = Visibility.Collapsed;
return;
}
long uid = 0;
@@ -287,6 +298,7 @@ private async Task GetGameNoticesAlertAsync()
}
if (uid == 0)
{
+ Image_GameNoticesAlert.Visibility = Visibility.Collapsed;
return;
}
if (await _launcherService.IsNoticesAlertAsync(gameBiz, uid))
@@ -877,7 +889,11 @@ private void GetGameAccount()
StackPanel_Account.Visibility = Visibility.Collapsed;
return;
}
- GameAccountList = _gameService.GetGameAccounts(gameBiz).ToList();
+ else
+ {
+ StackPanel_Account.Visibility = Visibility.Visible;
+ }
+ GameAccountList = _gameService.GetGameAccounts(gameBiz);
SelectGameAccount = GameAccountList.FirstOrDefault(x => x.IsLogin);
CanChangeGameAccount = false;
}
diff --git a/src/Starward/Pages/Setting/ExperienceSettingPage.xaml b/src/Starward/Pages/Setting/ExperienceSettingPage.xaml
index dceb9cba5..fa210006e 100644
--- a/src/Starward/Pages/Setting/ExperienceSettingPage.xaml
+++ b/src/Starward/Pages/Setting/ExperienceSettingPage.xaml
@@ -32,6 +32,21 @@
+
+
+
+
+
+
diff --git a/src/Starward/Pages/Setting/ExperienceSettingPage.xaml.cs b/src/Starward/Pages/Setting/ExperienceSettingPage.xaml.cs
index aaab08a6c..fafe6e252 100644
--- a/src/Starward/Pages/Setting/ExperienceSettingPage.xaml.cs
+++ b/src/Starward/Pages/Setting/ExperienceSettingPage.xaml.cs
@@ -1,5 +1,8 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.Logging;
using Microsoft.UI.Xaml.Controls;
+using Starward.Messages;
using Starward.Models;
using System;
@@ -11,6 +14,7 @@ namespace Starward.Pages.Setting;
///
/// An empty page that can be used on its own or navigated to within a Frame.
///
+[INotifyPropertyChanged]
public sealed partial class ExperienceSettingPage : PageBase
{
@@ -102,5 +106,32 @@ private void ComboBox_CloseWindowOption_SelectionChanged(object sender, Selectio
+ #region Features
+
+
+
+ [ObservableProperty]
+ private bool disableGameAccountSwitcher = AppConfig.DisableGameAccountSwitcher;
+ partial void OnDisableGameAccountSwitcherChanged(bool value)
+ {
+ AppConfig.DisableGameAccountSwitcher = value;
+ WeakReferenceMessenger.Default.Send(new GameAccountSwitcherDisabledChanged(value));
+ }
+
+
+ [ObservableProperty]
+ private bool disableGameNoticeRedHot = AppConfig.DisableGameNoticeRedHot;
+ partial void OnDisableGameNoticeRedHotChanged(bool value)
+ {
+ AppConfig.DisableGameNoticeRedHot = value;
+ WeakReferenceMessenger.Default.Send(new GameNoticeRedHotDisabledChanged(value));
+ }
+
+
+
+
+ #endregion
+
+
}