mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 12:52:08 +08:00
1.1.3 -> 1.1.4 第24次更新
This commit is contained in:
parent
2e07e97e01
commit
fe8f73afb8
@ -98,13 +98,13 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ThemesButtonDarkThemeContent" xml:space="preserve">
|
||||
<value>跟随系统</value>
|
||||
<value>亮色模式</value>
|
||||
</data>
|
||||
<data name="ThemesButtonInheritThemeContent" xml:space="preserve">
|
||||
<value>暗色模式</value>
|
||||
</data>
|
||||
<data name="ThemesButtonLightThemeContent" xml:space="preserve">
|
||||
<value>亮色模式</value>
|
||||
<value>跟随系统</value>
|
||||
</data>
|
||||
<data name="ThemesButtonToolTip" xml:space="preserve">
|
||||
<value>点击切换显示主题</value>
|
||||
|
@ -1,12 +1,25 @@
|
||||
using System.Windows;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Sheas_Cealer.Props;
|
||||
using Sheas_Cealer.Utils;
|
||||
|
||||
namespace Sheas_Cealer.Preses;
|
||||
|
||||
internal partial class GlobalPres : ObservableObject
|
||||
{
|
||||
internal GlobalPres()
|
||||
{
|
||||
IsLightTheme = Settings.Default.IsLightTheme switch
|
||||
{
|
||||
-1 => null,
|
||||
0 => false,
|
||||
1 => true,
|
||||
_ => throw new UnreachableException()
|
||||
};
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
private static bool? isLightTheme = null;
|
||||
partial void OnIsLightThemeChanged(bool? value)
|
||||
@ -19,5 +32,8 @@ internal partial class GlobalPres : ObservableObject
|
||||
|
||||
foreach (Window currentWindow in Application.Current.Windows)
|
||||
BorderThemeSetter.SetBorderTheme(currentWindow, value);
|
||||
|
||||
Settings.Default.IsLightTheme = (sbyte)(value.HasValue ? value.GetValueOrDefault() ? 1 : 0 : -1);
|
||||
Settings.Default.Save();
|
||||
}
|
||||
}
|
14
Props/Settings.Designer.cs
generated
14
Props/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace Sheas_Cealer.Props {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
@ -58,5 +58,17 @@ namespace Sheas_Cealer.Props {
|
||||
this["ExtraArgs"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("-1")]
|
||||
public sbyte IsLightTheme {
|
||||
get {
|
||||
return ((sbyte)(this["IsLightTheme"]));
|
||||
}
|
||||
set {
|
||||
this["IsLightTheme"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,8 @@
|
||||
<Setting Name="ExtraArgs" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="IsLightTheme" Type="System.SByte" Scope="User">
|
||||
<Value Profile="(Default)">-1</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -16,6 +16,9 @@ internal static partial class BorderThemeSetter
|
||||
|
||||
internal static void SetBorderTheme(Window window, bool? isLightTheme)
|
||||
{
|
||||
if (!window.IsLoaded)
|
||||
return;
|
||||
|
||||
nint isDarkTheme;
|
||||
nint desktopHwnd = nint.Zero;
|
||||
nint windowHwnd = new WindowInteropHelper(window).EnsureHandle();
|
||||
|
Loading…
Reference in New Issue
Block a user