From 83feb096c80ab8076d5d83987860ac5b5bcfbdbe Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 29 Nov 2021 08:07:08 +1100 Subject: [PATCH] update to constants and change method name to OpenThemeFolder --- Flow.Launcher.Infrastructure/Constant.cs | 4 ++++ Flow.Launcher/MainWindow.xaml.cs | 7 +++---- Flow.Launcher/SettingWindow.xaml | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 10 +++++----- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 3 --- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index 081dd9909..cd49217a4 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -35,6 +35,10 @@ namespace Flow.Launcher.Infrastructure public const string DefaultTheme = "Win11Light"; + public const string Light = "Light"; + public const string Dark = "Dark"; + public const string System = "System"; + public const string Themes = "Themes"; public const string Settings = "Settings"; public const string Logs = "Logs"; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 718606ff7..ef0c8f932 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -16,6 +16,7 @@ using ContextMenuStrip = System.Windows.Forms.ContextMenuStrip; using DragEventArgs = System.Windows.DragEventArgs; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using NotifyIcon = System.Windows.Forms.NotifyIcon; +using Flow.Launcher.Infrastructure; namespace Flow.Launcher { @@ -480,16 +481,14 @@ namespace Flow.Launcher public void InitializeDarkMode() { - if (_settings.DarkMode == "Light") + if (_settings.DarkMode == Constant.Light) { ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light; } - else if (_settings.DarkMode == "Dark") + else if (_settings.DarkMode == Constant.Dark) { ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark; } - else - { } } } } \ No newline at end of file diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 9278b5680..e5fbd53c8 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1949,7 +1949,7 @@ Width="180" Margin="0,0,18,0" HorizontalAlignment="Center" - Click="OpenPluginFolder" + Click="OpenThemeFolder" Content="{DynamicResource OpenThemeFolder}" DockPanel.Dock="Top" /> diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index d8bc4da6a..3505269f2 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -265,7 +265,7 @@ namespace Flow.Launcher Close(); } - private void OpenPluginFolder(object sender, RoutedEventArgs e) + private void OpenThemeFolder(object sender, RoutedEventArgs e) { PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Themes)); } @@ -277,7 +277,7 @@ namespace Flow.Launcher private void OpenLogFolder(object sender, RoutedEventArgs e) { - PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Logs)); + PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version)); } private void OnPluginStoreRefreshClick(object sender, RoutedEventArgs e) @@ -308,9 +308,9 @@ namespace Flow.Launcher private void DarkModeSelectedIndexChanged(object sender, EventArgs e) => ThemeManager.Current.ApplicationTheme = settings.DarkMode switch { - "Light" => ApplicationTheme.Light, - "Dark" => ApplicationTheme.Dark, - "System" => null, + Constant.Light => ApplicationTheme.Light, + Constant.Dark => ApplicationTheme.Dark, + Constant.System => null, _ => ThemeManager.Current.ApplicationTheme }; diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 5a0d816b9..96c14ebe0 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -15,12 +15,10 @@ using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure; -using Flow.Launcher.Infrastructure.Image; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; -using ApplicationTheme = ModernWpf.ApplicationTheme; namespace Flow.Launcher.ViewModel { @@ -387,7 +385,6 @@ namespace Flow.Launcher.ViewModel } } - public ResultsViewModel PreviewResults { get