Rename navigation views in settings, change the way they're navigated to

This commit is contained in:
Yusyuriv 2024-04-29 09:58:54 +06:00
parent 7e4a37c1a3
commit a084af683d
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
16 changed files with 58 additions and 66 deletions

View file

@ -1,5 +1,5 @@
<ui:Page
x:Class="Flow.Launcher.SettingPages.Views.About"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPaneAbout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View file

@ -22,9 +22,9 @@ using Path = System.IO.Path;
namespace Flow.Launcher.SettingPages.Views
{
public partial class About
public partial class SettingsPaneAbout
{
public About()
public SettingsPaneAbout()
{
InitializeComponent();
}

View file

@ -1,5 +1,5 @@
<ui:Page
x:Class="Flow.Launcher.SettingPages.Views.General"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPaneGeneral"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
@ -361,4 +361,4 @@
</cc:Card>
</VirtualizingStackPanel>
</ScrollViewer>
</ui:Page>
</ui:Page>

View file

@ -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)
{

View file

@ -1,5 +1,5 @@
<Page
x:Class="Flow.Launcher.SettingPages.Views.Hotkey"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPaneHotkey"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"

View file

@ -18,9 +18,9 @@ namespace Flow.Launcher.SettingPages.Views
/// <summary>
/// Hotkey.xaml에 대한 상호 작용 논리
/// </summary>
public partial class Hotkey : Page
public partial class SettingsPaneHotkey : Page
{
public Hotkey()
public SettingsPaneHotkey()
{
InitializeComponent();
}

View file

@ -1,5 +1,5 @@
<Page
x:Class="Flow.Launcher.SettingPages.Views.PluginStore"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPanePluginStore"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View file

@ -18,9 +18,9 @@ namespace Flow.Launcher.SettingPages.Views
/// <summary>
/// PluginStore.xaml에 대한 상호 작용 논리
/// </summary>
public partial class PluginStore : Page
public partial class SettingsPanePluginStore : Page
{
public PluginStore()
public SettingsPanePluginStore()
{
InitializeComponent();
}

View file

@ -1,5 +1,5 @@
<ui:Page
x:Class="Flow.Launcher.SettingPages.Views.Plugins"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPanePlugins"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View file

@ -18,9 +18,9 @@ namespace Flow.Launcher.SettingPages.Views
/// <summary>
/// Plugins.xaml에 대한 상호 작용 논리
/// </summary>
public partial class Plugins
public partial class SettingsPanePlugins
{
public Plugins()
public SettingsPanePlugins()
{
InitializeComponent();
}

View file

@ -1,5 +1,5 @@
<Page
x:Class="Flow.Launcher.SettingPages.Views.Proxy"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPaneProxy"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View file

@ -18,9 +18,9 @@ namespace Flow.Launcher.SettingPages.Views
/// <summary>
/// Proxy.xaml에 대한 상호 작용 논리
/// </summary>
public partial class Proxy : Page
public partial class SettingsPaneProxy : Page
{
public Proxy()
public SettingsPaneProxy()
{
InitializeComponent();
}

View file

@ -1,5 +1,5 @@
<ui:Page
x:Class="Flow.Launcher.SettingPages.Views.Theme"
x:Class="Flow.Launcher.SettingPages.Views.SettingsPaneTheme"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
@ -18,7 +18,7 @@
Margin="0,0,0,0"
Padding="6,0,24,0"
FontSize="14"
ScrollViewer.CanContentScroll="True"
CanContentScroll="True"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.ScrollUnit="Pixel">
<Grid Margin="0,0,0,0">
@ -77,6 +77,7 @@
</Border>
<StackPanel
x:Name="ClockPanel"
Grid.Row="0"
IsHitTestVisible="False"
Style="{DynamicResource ClockPanel}"
Visibility="Visible">
@ -91,7 +92,7 @@
Text="{Binding DateText}"
Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<Canvas Style="{DynamicResource SearchIconPosition}">
<Canvas Grid.Row="0" Style="{DynamicResource SearchIconPosition}">
<Path
Margin="0"
Data="{DynamicResource SearchIconImg}"

View file

@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
@ -12,14 +10,14 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ModernWpf.Controls;
namespace Flow.Launcher.SettingPages.Views
namespace Flow.Launcher.SettingPages.Views;
public partial class SettingsPaneTheme : Page
{
public partial class Theme
public SettingsPaneTheme()
{
public Theme()
{
InitializeComponent();
}
InitializeComponent();
}
}

View file

@ -221,66 +221,52 @@
</ui:NavigationView.PaneCustomContent>
<ui:NavigationView.MenuItems>
<ui:NavigationViewItem
x:Name="General"
Content="{DynamicResource general}"
Tag="General">
<ui:NavigationViewItem x:Name="General" Content="{DynamicResource general}">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/settings.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="plugin"
Content="{DynamicResource plugin}"
SelectsOnInvoked="True"
Tag="Plugins">
<ui:NavigationViewItem x:Name="Plugins" Content="{DynamicResource plugin}">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/plugins.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="pluginstore"
Content="{DynamicResource pluginStore}"
<ui:NavigationViewItem x:Name="PluginStore" Content="{DynamicResource pluginStore}"
Tag="PluginStore">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/store.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="Theme"
Content="{DynamicResource theme}"
Tag="Theme">
<ui:NavigationViewItem x:Name="Theme" Content="{DynamicResource theme}">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/theme.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="Hotkey"
Content="{DynamicResource hotkey}"
Tag="Hotkey">
<ui:NavigationViewItem x:Name="Hotkey" Content="{DynamicResource hotkey}">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/keyboard.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="Proxy"
Content="{DynamicResource proxy}"
Tag="Proxy">
<ui:NavigationViewItem x:Name="Proxy" Content="{DynamicResource proxy}">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/proxy.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
<ui:NavigationViewItem
x:Name="About"
Content="{DynamicResource about}"
Tag="About">
<ui:NavigationViewItem x:Name="About" Content="{DynamicResource about}">
<ui:NavigationViewItem.Icon>
<ui:BitmapIcon ShowAsMonochrome="False" UriSource="/Images/info.png" />
</ui:NavigationViewItem.Icon>
</ui:NavigationViewItem>
</ui:NavigationView.MenuItems>
<Grid>
<ui:Frame x:Name="contentFrame" Margin="0" />
<ui:Frame x:Name="ContentFrame" Margin="0" />
</Grid>
</ui:NavigationView>
</Grid>

View file

@ -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);
}
}
}