diff --git a/src/InvLock/DataContexts/MainWindowDataContext.cs b/src/InvLock/DataContexts/MainWindowDataContext.cs index 65e5860..136f959 100644 --- a/src/InvLock/DataContexts/MainWindowDataContext.cs +++ b/src/InvLock/DataContexts/MainWindowDataContext.cs @@ -1,9 +1,8 @@ -using System.ComponentModel; -using System.Reflection; +using System.Reflection; namespace InvLock.DataContexts; -internal class MainWindowDataContext : INotifyPropertyChanged +internal class MainWindowDataContext { #if DEBUG public string Title => $"{App.AppName} - Dev {AppVersion}"; diff --git a/src/InvLock/MainWindow.xaml b/src/InvLock/MainWindow.xaml index e2b90ba..b547b02 100644 --- a/src/InvLock/MainWindow.xaml +++ b/src/InvLock/MainWindow.xaml @@ -76,7 +76,7 @@ - + @@ -129,7 +129,26 @@ - + + + + + + + + + + + + + + + + + + + + @@ -140,13 +159,9 @@ - - + + - - - - diff --git a/src/InvLock/Settings.cs b/src/InvLock/Settings.cs index 33a03ee..33bc1d8 100644 --- a/src/InvLock/Settings.cs +++ b/src/InvLock/Settings.cs @@ -3,6 +3,8 @@ using System.IO; using System.Runtime.CompilerServices; using System.Text.Json; +using Wpf.Ui.Appearance; + namespace InvLock; public class Settings : INotifyPropertyChanged @@ -12,6 +14,7 @@ public class Settings : INotifyPropertyChanged private static readonly string settingsPath = Path.Combine(App.ApplicationDataPath, "settings.json"); private bool hideWindows = false; private string lockText = "Lock Screen Active"; + private string theme = "Windows default"; private string unlockText = "Lock Screen Inactive"; @@ -45,6 +48,30 @@ public class Settings : INotifyPropertyChanged } } + public string Theme + { + get => theme; + set + { + theme = value; + + if (value == "Windows default") + { + ApplicationThemeManager.ApplySystemTheme(); + } + else if (value == "Light") + { + ApplicationThemeManager.Apply(ApplicationTheme.Light); + } + else if (value == "Dark") + { + ApplicationThemeManager.Apply(ApplicationTheme.Dark); + } + + OnPropertyChanged(); + } + } + public static Settings Load() { if (File.Exists(settingsPath))