1.1.3 -> 1.1.4 第38次更新

This commit is contained in:
Space Time 2024-12-09 22:11:42 +08:00
parent 5e94c1e81b
commit 73f411aca3
2 changed files with 7 additions and 1 deletions

View File

@ -17,25 +17,31 @@ public partial class App : Application
{ {
_ = new SettingsPres(); _ = new SettingsPres();
#region Primary Color
PaletteHelper paletteHelper = new(); PaletteHelper paletteHelper = new();
Theme newTheme = paletteHelper.GetTheme(); Theme newTheme = paletteHelper.GetTheme();
System.Drawing.Color newColor = Settings.Default.PrimaryColor; System.Drawing.Color newColor = Settings.Default.PrimaryColor;
newTheme.SetPrimaryColor(Color.FromRgb(newColor.R, newColor.G, newColor.B)); newTheme.SetPrimaryColor(Color.FromRgb(newColor.R, newColor.G, newColor.B));
paletteHelper.SetTheme(newTheme); paletteHelper.SetTheme(newTheme);
#endregion Primary Color
#region Background Color
if (Environment.OSVersion.Version.Build < 22000) if (Environment.OSVersion.Version.Build < 22000)
{ {
Style newWindowStyle = new(typeof(Window), Current.Resources["CommonWindow"] as Style); Style newWindowStyle = new(typeof(Window), Current.Resources["CommonWindow"] as Style);
newWindowStyle.Setters.Add(new Setter(Window.BackgroundProperty, new DynamicResourceExtension("MaterialDesignBackground"))); newWindowStyle.Setters.Add(new Setter(Window.BackgroundProperty, new DynamicResourceExtension("MaterialDesignBackground")));
Current.Resources["CommonWindow"] = newWindowStyle; Current.Resources["CommonWindow"] = newWindowStyle;
} }
#endregion Background Color
#region Foreground Color
Color? foregroundColor = ForegroundGenerator.GetForeground(newColor.R, newColor.G, newColor.B); Color? foregroundColor = ForegroundGenerator.GetForeground(newColor.R, newColor.G, newColor.B);
Style newButtonStyle = new(typeof(Button), Current.Resources[typeof(Button)] as Style); Style newButtonStyle = new(typeof(Button), Current.Resources[typeof(Button)] as Style);
newButtonStyle.Setters.Add(new Setter(Button.ForegroundProperty, foregroundColor.HasValue ? new SolidColorBrush(foregroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground"))); newButtonStyle.Setters.Add(new Setter(Button.ForegroundProperty, foregroundColor.HasValue ? new SolidColorBrush(foregroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
Current.Resources[typeof(Button)] = newButtonStyle; Current.Resources[typeof(Button)] = newButtonStyle;
#endregion Foreground Color
new MainWin(e.Args).Show(); new MainWin(e.Args).Show();
} }

View File

@ -39,4 +39,4 @@ namespace Sheas_Cealer.Utils
IsCleaning = false; IsCleaning = false;
} }
} }
} }