mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-02-18 00:17:43 +01:00
Fix theme not being applied when changed by the system (#1368)
This commit is contained in:
@@ -230,7 +230,8 @@ namespace LibationAvalonia
|
||||
private static void ShowMainWindow(IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
Configuration.Instance.PropertyChanged += ThemeVariant_PropertyChanged;
|
||||
OpenAndApplyTheme(Configuration.Instance.GetString(propertyName: nameof(ThemeVariant)));
|
||||
Current.ActualThemeVariantChanged += OnActualThemeVariantChanged;
|
||||
OnActualThemeVariantChanged(Current, EventArgs.Empty);
|
||||
|
||||
var mainWindow = new MainWindow();
|
||||
desktop.MainWindow = MainWindow = mainWindow;
|
||||
@@ -243,6 +244,9 @@ namespace LibationAvalonia
|
||||
private static void ThemeVariant_PropertyChanged(object sender, PropertyChangedEventArgsEx e)
|
||||
=> OpenAndApplyTheme(e.NewValue as string);
|
||||
|
||||
private static void OnActualThemeVariantChanged(object? sender, EventArgs e)
|
||||
=> OpenAndApplyTheme(Configuration.Instance.GetString(propertyName: nameof(ThemeVariant)));
|
||||
|
||||
private static void OpenAndApplyTheme(string? themeVariant)
|
||||
{
|
||||
using var themePersister = ChardonnayThemePersister.Create();
|
||||
|
||||
Reference in New Issue
Block a user