1.1.3 -> 1.1.4 第63次更新

This commit is contained in:
Space Time 2024-12-14 14:20:12 +08:00
parent f8501fc05b
commit 029bd787dc
5 changed files with 5 additions and 7 deletions

View File

@ -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

View File

@ -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";
}

View File

@ -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;

View File

@ -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<string>(AboutConst.ReleaseApiUrl, AboutClient)).RootElement;

View File

@ -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);