1.1.3 -> 1.1.4 第36次更新

This commit is contained in:
Space Time 2024-12-07 22:40:17 +08:00
parent 688412f2b5
commit dda0c2efee
4 changed files with 26 additions and 19 deletions

View File

@ -1,4 +1,6 @@
using System.Windows;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using MaterialDesignThemes.Wpf;
@ -22,12 +24,18 @@ public partial class App : Application
newTheme.SetPrimaryColor(Color.FromRgb(newColor.R, newColor.G, newColor.B));
paletteHelper.SetTheme(newTheme);
if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build < 22000)
{
Style newWindowStyle = new(typeof(Window), Current.Resources["CommonWindow"] as Style);
newWindowStyle.Setters.Add(new Setter(Window.BackgroundProperty, new DynamicResourceExtension("MaterialDesignBackground")));
Current.Resources["CommonWindow"] = newWindowStyle;
}
Color? foregroundColor = ForegroundGenerator.GetForeground(newColor.R, newColor.G, newColor.B);
if (foregroundColor.HasValue)
Current.Resources["MaterialDesignBackground"] = new SolidColorBrush(foregroundColor.Value);
else
Current.Resources.Remove("MaterialDesignBackground");
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")));
Current.Resources[typeof(Button)] = newButtonStyle;
new MainWin(e.Args).Show();
}

View File

@ -51,13 +51,13 @@ internal partial class SettingsPres : GlobalPres
{
FontWeight newWeight = value.HasValue ? value.Value ? FontWeights.Light : FontWeights.Bold : FontWeights.Regular;
Style newStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style);
newStyle.Setters.Add(new Setter(Window.FontWeightProperty, newWeight));
Application.Current.Resources["CommonWindow"] = newStyle;
Style newWindowStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style);
newWindowStyle.Setters.Add(new Setter(Window.FontWeightProperty, newWeight));
Application.Current.Resources["CommonWindow"] = newWindowStyle;
newStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
newStyle.Setters.Add(new Setter(Button.FontWeightProperty, newWeight));
Application.Current.Resources[typeof(Button)] = newStyle;
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
newButtonStyle.Setters.Add(new Setter(Button.FontWeightProperty, newWeight));
Application.Current.Resources[typeof(Button)] = newButtonStyle;
Settings.Default.IsLightWeight = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1);
Settings.Default.Save();

View File

@ -470,10 +470,9 @@ public partial class MainWin : Window
Color? foregroundColor = ForegroundGenerator.GetForeground(newColor.R, newColor.G, newColor.B);
if (foregroundColor.HasValue)
Application.Current.Resources["MaterialDesignBackground"] = new SolidColorBrush(foregroundColor.Value);
else
Application.Current.Resources.Remove("MaterialDesignBackground");
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
newButtonStyle.Setters.Add(new Setter(Button.ForegroundProperty, foregroundColor.HasValue ? new SolidColorBrush(foregroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
Application.Current.Resources[typeof(Button)] = newButtonStyle;
if (GameFlashInterval > 100)
GameFlashInterval += random.Next(1, 4);

View File

@ -1,5 +1,6 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using MaterialDesignThemes.Wpf;
@ -46,10 +47,9 @@ public partial class SettingsWin : Window
Color? foregroundColor = ForegroundGenerator.GetForeground(newColor.R, newColor.G, newColor.B);
if (foregroundColor.HasValue)
Application.Current.Resources["MaterialDesignBackground"] = new SolidColorBrush(foregroundColor.Value);
else
Application.Current.Resources.Remove("MaterialDesignBackground");
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
newButtonStyle.Setters.Add(new Setter(Button.ForegroundProperty, foregroundColor.HasValue ? new SolidColorBrush(foregroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
Application.Current.Resources[typeof(Button)] = newButtonStyle;
Settings.Default.PrimaryColor = System.Drawing.Color.FromArgb(newColor.A, newColor.R, newColor.G, newColor.B);
Settings.Default.Save();