edit dark theme implementation

This commit is contained in:
Jakob 2023-07-14 12:55:18 +02:00
parent 6d281e4e44
commit 58bef7537f
2 changed files with 4 additions and 0 deletions

View file

@ -7,6 +7,7 @@
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Light"/>
<ui:ControlsDictionary /> <ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View file

@ -19,13 +19,16 @@ namespace EnvyUpdate
{ {
protected override void OnStartup(StartupEventArgs e) protected override void OnStartup(StartupEventArgs e)
{ {
// Remove placeholder light theme and apply system app theme
Wpf.Ui.Appearance.Accent.ApplySystemAccent(); Wpf.Ui.Appearance.Accent.ApplySystemAccent();
Application.Current.Resources.MergedDictionaries.RemoveAt(0);
ThemesDictionary themedict = new ThemesDictionary(); ThemesDictionary themedict = new ThemesDictionary();
if (Util.IsDarkTheme()) if (Util.IsDarkTheme())
themedict.Theme = Wpf.Ui.Appearance.ThemeType.Dark; themedict.Theme = Wpf.Ui.Appearance.ThemeType.Dark;
else else
themedict.Theme = Wpf.Ui.Appearance.ThemeType.Light; themedict.Theme = Wpf.Ui.Appearance.ThemeType.Light;
Application.Current.Resources.MergedDictionaries.Add(themedict); Application.Current.Resources.MergedDictionaries.Add(themedict);
// TODO: Watch for theme changes and dynamically update
// Listen to notification activation // Listen to notification activation
ToastNotificationManagerCompat.OnActivated += toastArgs => ToastNotificationManagerCompat.OnActivated += toastArgs =>