mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 21:02:08 +08:00
1.1.3 -> 1.1.4 第11次更新
This commit is contained in:
parent
5bd9ef3e58
commit
94ede5b64b
@ -1,18 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
|
||||
namespace Sheas_Cealer.Preses;
|
||||
|
||||
internal partial class AppPres : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool? isLightTheme = null;
|
||||
partial void OnIsLightThemeChanged(bool? value)
|
||||
{
|
||||
PaletteHelper paletteHelper = new();
|
||||
Theme newTheme = paletteHelper.GetTheme();
|
||||
|
||||
newTheme.SetBaseTheme(value.HasValue ? value.GetValueOrDefault() ? BaseTheme.Light : BaseTheme.Dark : BaseTheme.Inherit);
|
||||
paletteHelper.SetTheme(newTheme);
|
||||
}
|
||||
}
|
26
Preses/GlobalPres.cs
Normal file
26
Preses/GlobalPres.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
|
||||
namespace Sheas_Cealer.Preses;
|
||||
|
||||
internal partial class GlobalPres : ObservableRecipient, IRecipient<PropertyChangedMessage<object>>
|
||||
{
|
||||
internal GlobalPres() => IsActive = true;
|
||||
|
||||
[ObservableProperty, NotifyPropertyChangedRecipients]
|
||||
private bool? isLightTheme = null;
|
||||
partial void OnIsLightThemeChanged(bool? value)
|
||||
{
|
||||
PaletteHelper paletteHelper = new();
|
||||
Theme newTheme = paletteHelper.GetTheme();
|
||||
|
||||
newTheme.SetBaseTheme(value.HasValue ? value.GetValueOrDefault() ? BaseTheme.Light : BaseTheme.Dark : BaseTheme.Inherit);
|
||||
paletteHelper.SetTheme(newTheme);
|
||||
}
|
||||
|
||||
protected override void Broadcast<T>(T oldValue, T newValue, string? propertyName) => Messenger.Send(new PropertyChangedMessage<object>(this, propertyName, oldValue!, newValue!));
|
||||
|
||||
public void Receive(PropertyChangedMessage<object> message) => GetType().GetProperty(message.PropertyName!)!.SetValue(this, message.NewValue);
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Microsoft.Win32;
|
||||
using Sheas_Cealer.Consts;
|
||||
using Sheas_Cealer.Props;
|
||||
@ -10,7 +9,7 @@ using File = System.IO.File;
|
||||
|
||||
namespace Sheas_Cealer.Preses;
|
||||
|
||||
internal partial class MainPres : AppPres
|
||||
internal partial class MainPres : GlobalPres
|
||||
{
|
||||
internal MainPres(string[] args)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user