From a084af683d0d391747b7cb97eb59723a5f97a303 Mon Sep 17 00:00:00 2001 From: Yusyuriv Date: Mon, 29 Apr 2024 09:58:54 +0600 Subject: [PATCH] Rename navigation views in settings, change the way they're navigated to --- .../{About.xaml => SettingsPaneAbout.xaml} | 2 +- ...bout.xaml.cs => SettingsPaneAbout.xaml.cs} | 4 +- ...{General.xaml => SettingsPaneGeneral.xaml} | 4 +- ...al.xaml.cs => SettingsPaneGeneral.xaml.cs} | 2 +- .../{Hotkey.xaml => SettingsPaneHotkey.xaml} | 2 +- ...key.xaml.cs => SettingsPaneHotkey.xaml.cs} | 4 +- ...tore.xaml => SettingsPanePluginStore.xaml} | 2 +- ...aml.cs => SettingsPanePluginStore.xaml.cs} | 4 +- ...{Plugins.xaml => SettingsPanePlugins.xaml} | 2 +- ...ns.xaml.cs => SettingsPanePlugins.xaml.cs} | 4 +- .../{Proxy.xaml => SettingsPaneProxy.xaml} | 2 +- ...roxy.xaml.cs => SettingsPaneProxy.xaml.cs} | 4 +- .../{Theme.xaml => SettingsPaneTheme.xaml} | 7 +-- ...heme.xaml.cs => SettingsPaneTheme.xaml.cs} | 14 +++--- Flow.Launcher/SettingWindow.xaml | 44 +++++++------------ Flow.Launcher/SettingWindow.xaml.cs | 23 ++++++---- 16 files changed, 58 insertions(+), 66 deletions(-) rename Flow.Launcher/SettingPages/Views/{About.xaml => SettingsPaneAbout.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{About.xaml.cs => SettingsPaneAbout.xaml.cs} (91%) rename Flow.Launcher/SettingPages/Views/{General.xaml => SettingsPaneGeneral.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{General.xaml.cs => SettingsPaneGeneral.xaml.cs} (97%) rename Flow.Launcher/SettingPages/Views/{Hotkey.xaml => SettingsPaneHotkey.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{Hotkey.xaml.cs => SettingsPaneHotkey.xaml.cs} (87%) rename Flow.Launcher/SettingPages/Views/{PluginStore.xaml => SettingsPanePluginStore.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{PluginStore.xaml.cs => SettingsPanePluginStore.xaml.cs} (85%) rename Flow.Launcher/SettingPages/Views/{Plugins.xaml => SettingsPanePlugins.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{Plugins.xaml.cs => SettingsPanePlugins.xaml.cs} (87%) rename Flow.Launcher/SettingPages/Views/{Proxy.xaml => SettingsPaneProxy.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{Proxy.xaml.cs => SettingsPaneProxy.xaml.cs} (87%) rename Flow.Launcher/SettingPages/Views/{Theme.xaml => SettingsPaneTheme.xaml} (99%) rename Flow.Launcher/SettingPages/Views/{Theme.xaml.cs => SettingsPaneTheme.xaml.cs} (62%) diff --git a/Flow.Launcher/SettingPages/Views/About.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml similarity index 99% rename from Flow.Launcher/SettingPages/Views/About.xaml rename to Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml index e5d58098c..9386c9625 100644 --- a/Flow.Launcher/SettingPages/Views/About.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -1,5 +1,5 @@  - \ No newline at end of file + diff --git a/Flow.Launcher/SettingPages/Views/General.xaml.cs b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs similarity index 97% rename from Flow.Launcher/SettingPages/Views/General.xaml.cs rename to Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs index 2aaa0fbc2..012a8b70d 100644 --- a/Flow.Launcher/SettingPages/Views/General.xaml.cs +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs @@ -34,7 +34,7 @@ using Flow.Launcher.ViewModel; namespace Flow.Launcher.SettingPages.Views { - public partial class General + public partial class SettingsPaneGeneral { protected override void OnNavigatedTo(NavigationEventArgs e) { diff --git a/Flow.Launcher/SettingPages/Views/Hotkey.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml similarity index 99% rename from Flow.Launcher/SettingPages/Views/Hotkey.xaml rename to Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml index 20a69971c..c8a510e4f 100644 --- a/Flow.Launcher/SettingPages/Views/Hotkey.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml @@ -1,5 +1,5 @@  /// Hotkey.xaml에 대한 상호 작용 논리 /// - public partial class Hotkey : Page + public partial class SettingsPaneHotkey : Page { - public Hotkey() + public SettingsPaneHotkey() { InitializeComponent(); } diff --git a/Flow.Launcher/SettingPages/Views/PluginStore.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml similarity index 99% rename from Flow.Launcher/SettingPages/Views/PluginStore.xaml rename to Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml index 3a0d3bac1..bed68e86a 100644 --- a/Flow.Launcher/SettingPages/Views/PluginStore.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml @@ -1,5 +1,5 @@  /// PluginStore.xaml에 대한 상호 작용 논리 /// - public partial class PluginStore : Page + public partial class SettingsPanePluginStore : Page { - public PluginStore() + public SettingsPanePluginStore() { InitializeComponent(); } diff --git a/Flow.Launcher/SettingPages/Views/Plugins.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml similarity index 99% rename from Flow.Launcher/SettingPages/Views/Plugins.xaml rename to Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml index dc8d3ebdf..9a9b05183 100644 --- a/Flow.Launcher/SettingPages/Views/Plugins.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml @@ -1,5 +1,5 @@  /// Plugins.xaml에 대한 상호 작용 논리 /// - public partial class Plugins + public partial class SettingsPanePlugins { - public Plugins() + public SettingsPanePlugins() { InitializeComponent(); } diff --git a/Flow.Launcher/SettingPages/Views/Proxy.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml similarity index 99% rename from Flow.Launcher/SettingPages/Views/Proxy.xaml rename to Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml index 41742a276..48d7a89d5 100644 --- a/Flow.Launcher/SettingPages/Views/Proxy.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml @@ -1,5 +1,5 @@  /// Proxy.xaml에 대한 상호 작용 논리 /// - public partial class Proxy : Page + public partial class SettingsPaneProxy : Page { - public Proxy() + public SettingsPaneProxy() { InitializeComponent(); } diff --git a/Flow.Launcher/SettingPages/Views/Theme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml similarity index 99% rename from Flow.Launcher/SettingPages/Views/Theme.xaml rename to Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 7ee9c7934..61b0b199b 100644 --- a/Flow.Launcher/SettingPages/Views/Theme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -1,5 +1,5 @@  @@ -77,6 +77,7 @@ @@ -91,7 +92,7 @@ Text="{Binding DateText}" Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" /> - + - + - + + - - + + - + + - + + - + + + - + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 8f3edc872..08d175d76 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -506,25 +506,32 @@ namespace Flow.Launcher //} /** For Navigation View **/ - private void NavigationView_SelectionChanged(ModernWpf.Controls.NavigationView sender, ModernWpf.Controls.NavigationViewSelectionChangedEventArgs args) + private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { if (args.IsSettingsSelected) { - contentFrame.Navigate(typeof(General)); + ContentFrame.Navigate(typeof(SettingsPaneGeneral)); } else { - var selectedItem = (ModernWpf.Controls.NavigationViewItem)args.SelectedItem; + var selectedItem = (NavigationViewItem)args.SelectedItem; if (selectedItem == null) { return; } - string selectedItemTag = (string)selectedItem.Tag; - sender.Header = (string)selectedItem.Content; - string pageName = $"Flow.Launcher.SettingPages.Views.{selectedItemTag}"; - Type pageType = typeof(About).Assembly.GetType(pageName); - contentFrame.Navigate(pageType, settings); + var pageType = selectedItem.Name switch + { + nameof(General) => typeof(SettingsPaneGeneral), + nameof(Plugins) => typeof(SettingsPanePlugins), + nameof(PluginStore) => typeof(SettingsPanePluginStore), + nameof(Theme) => typeof(SettingsPaneTheme), + nameof(Hotkey) => typeof(SettingsPaneHotkey), + nameof(Proxy) => typeof(SettingsPaneProxy), + nameof(About) => typeof(SettingsPaneAbout), + _ => typeof(SettingsPaneGeneral) + }; + ContentFrame.Navigate(pageType, settings); } } }