diff --git a/App.xaml.cs b/App.xaml.cs index 2a969be..cd85398 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -18,9 +18,9 @@ public partial class App : Application #region Primary Color PaletteHelper paletteHelper = new(); Theme newTheme = paletteHelper.GetTheme(); - System.Drawing.Color newPrimaryColor = Settings.Default.PrimaryColor; + Color newPrimaryColor = Color.FromRgb(Settings.Default.PrimaryColor.R, Settings.Default.PrimaryColor.G, Settings.Default.PrimaryColor.B); - newTheme.SetPrimaryColor(Color.FromRgb(newPrimaryColor.R, newPrimaryColor.G, newPrimaryColor.B)); + newTheme.SetPrimaryColor(newPrimaryColor); paletteHelper.SetTheme(newTheme); #endregion Primary Color diff --git a/Consts/AboutConst.cs b/Consts/AboutConst.cs index 035eb78..1cddb02 100644 --- a/Consts/AboutConst.cs +++ b/Consts/AboutConst.cs @@ -16,4 +16,5 @@ internal class AboutConst : AboutMultilangConst public static string AgreementButtonUrl => "https://thoughts.teambition.com/share/6264edd78adeb10041b92fdb#title=Sheas_Cealer_使用协议"; internal static string ReleaseApiUrl => "https://api.github.com/repos/SpaceTimee/Sheas-Cealer/releases/latest"; + internal static string ReleaseApiUserAgent => "Sheas-Cealer"; } \ No newline at end of file diff --git a/Preses/SettingsPres.cs b/Preses/SettingsPres.cs index 52185f9..2a051f3 100644 --- a/Preses/SettingsPres.cs +++ b/Preses/SettingsPres.cs @@ -49,8 +49,8 @@ internal partial class SettingsPres : GlobalPres private static bool? isLightWeight = null; partial void OnIsLightWeightChanged(bool? value) { - Style newWindowStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style); FontWeight newWeight = value.HasValue ? value.Value ? FontWeights.Light : FontWeights.Bold : FontWeights.Regular; + Style newWindowStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style); newWindowStyle.Setters.Add(new Setter(Window.FontWeightProperty, newWeight)); Application.Current.Resources["CommonWindow"] = newWindowStyle; diff --git a/Wins/AboutWin.xaml.cs b/Wins/AboutWin.xaml.cs index 32b42bf..4d29f1d 100644 --- a/Wins/AboutWin.xaml.cs +++ b/Wins/AboutWin.xaml.cs @@ -35,7 +35,7 @@ public partial class AboutWin : Window { try { - AboutClient.DefaultRequestHeaders.Add("User-Agent", "Sheas-Cealer"); + AboutClient.DefaultRequestHeaders.Add("User-Agent", AboutConst.ReleaseApiUserAgent); JsonElement releaseInfoObject = JsonDocument.Parse(await Http.GetAsync(AboutConst.ReleaseApiUrl, AboutClient)).RootElement; diff --git a/Wins/MainWin.xaml.cs b/Wins/MainWin.xaml.cs index 6367dc8..626dc3a 100644 --- a/Wins/MainWin.xaml.cs +++ b/Wins/MainWin.xaml.cs @@ -489,12 +489,9 @@ public partial class MainWin : Window PaletteHelper paletteHelper = new(); Theme newTheme = paletteHelper.GetTheme(); Color newPrimaryColor = Color.FromRgb((byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256)); - Color newSecondaryColor = random.Next(3) == 0 ? newPrimaryColor with { R = (byte)((newPrimaryColor.R + 109) % 256) } : - random.Next(2) == 0 ? newPrimaryColor with { G = (byte)((newPrimaryColor.G + 109) % 256) } : newPrimaryColor with { B = (byte)((newPrimaryColor.B + 109) % 256) }; bool isLightTheme = random.Next(2) == 0; newTheme.SetPrimaryColor(newPrimaryColor); - newTheme.SetSecondaryColor(newSecondaryColor); newTheme.SetBaseTheme(isLightTheme ? BaseTheme.Light : BaseTheme.Dark); paletteHelper.SetTheme(newTheme);