优化
This commit is contained in:
@@ -686,7 +686,7 @@
|
|||||||
Visibility="{Binding ElementName=ToggleSwitchEnablePalmEraser, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
|
Visibility="{Binding ElementName=ToggleSwitchEnablePalmEraser, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Gesture_PalmSensitivity}" VerticalAlignment="Center"
|
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Gesture_PalmSensitivity}" VerticalAlignment="Center"
|
||||||
FontSize="14" Margin="0,0,16,0" />
|
FontSize="14" Margin="0,0,16,0" />
|
||||||
<ComboBox Name="ComboBoxPalmEraserSensitivity" Width="120" SelectionChanged="ComboBoxPalmEraserSensitivity_SelectionChanged">
|
<ComboBox Name="ComboBoxPalmEraserSensitivity" SelectionChanged="ComboBoxPalmEraserSensitivity_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityLow}" />
|
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityLow}" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityMedium}" />
|
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityMedium}" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityHigh}" />
|
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityHigh}" />
|
||||||
@@ -2180,7 +2180,7 @@
|
|||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,5,0,0">
|
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,5,0,0">
|
||||||
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Backup_Interval}" VerticalAlignment="Center"
|
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Backup_Interval}" VerticalAlignment="Center"
|
||||||
FontSize="14" Margin="0,0,16,0" />
|
FontSize="14" Margin="0,0,16,0" />
|
||||||
<ComboBox x:Name="ComboBoxAutoBackupInterval" Width="100" Margin="0,0,16,0"
|
<ComboBox x:Name="ComboBoxAutoBackupInterval" Margin="0,0,16,0"
|
||||||
SelectionChanged="ComboBoxAutoBackupInterval_SelectionChanged">
|
SelectionChanged="ComboBoxAutoBackupInterval_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Backup_Interval_1Day}" Tag="1" />
|
<ComboBoxItem Content="{i18n:I18n Key=Backup_Interval_1Day}" Tag="1" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Backup_Interval_3Days}" Tag="3" />
|
<ComboBoxItem Content="{i18n:I18n Key=Backup_Interval_3Days}" Tag="3" />
|
||||||
@@ -2208,7 +2208,7 @@
|
|||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=ConfigProfiles_Label}" VerticalAlignment="Center"
|
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=ConfigProfiles_Label}" VerticalAlignment="Center"
|
||||||
FontSize="14" Margin="0,0,8,0" />
|
FontSize="14" Margin="0,0,8,0" />
|
||||||
<ComboBox x:Name="ComboBoxConfigProfile" Width="220" MinWidth="180"
|
<ComboBox x:Name="ComboBoxConfigProfile" MinWidth="180"
|
||||||
SelectionChanged="ComboBoxConfigProfile_SelectionChanged" />
|
SelectionChanged="ComboBoxConfigProfile_SelectionChanged" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
@@ -2857,7 +2857,7 @@
|
|||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
<TextBlock Foreground="#a1a1aa" Text="{i18n:I18n Key=Storage_AutoSaveInterval}" VerticalAlignment="Center"
|
<TextBlock Foreground="#a1a1aa" Text="{i18n:I18n Key=Storage_AutoSaveInterval}" VerticalAlignment="Center"
|
||||||
FontSize="12" Margin="0,0,16,0" />
|
FontSize="12" Margin="0,0,16,0" />
|
||||||
<ComboBox Name="ComboBoxAutoSaveStrokesInterval" Width="120"
|
<ComboBox Name="ComboBoxAutoSaveStrokesInterval"
|
||||||
SelectionChanged="ComboBoxAutoSaveStrokesInterval_SelectionChanged">
|
SelectionChanged="ComboBoxAutoSaveStrokesInterval_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Storage_AutoSaveInterval_1Min}" Tag="1" />
|
<ComboBoxItem Content="{i18n:I18n Key=Storage_AutoSaveInterval_1Min}" Tag="1" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Storage_AutoSaveInterval_3Min}" Tag="3" />
|
<ComboBoxItem Content="{i18n:I18n Key=Storage_AutoSaveInterval_3Min}" Tag="3" />
|
||||||
@@ -2996,7 +2996,7 @@
|
|||||||
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
||||||
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Random_ExternalTypeLabel}"
|
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Random_ExternalTypeLabel}"
|
||||||
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
||||||
<ComboBox Name="ComboBoxExternalCallerType" Width="150" Height="30"
|
<ComboBox Name="ComboBoxExternalCallerType" Height="30"
|
||||||
IsEditable="False" IsReadOnly="True" SelectedIndex="0"
|
IsEditable="False" IsReadOnly="True" SelectedIndex="0"
|
||||||
SelectionChanged="ComboBoxExternalCallerType_SelectionChanged">
|
SelectionChanged="ComboBoxExternalCallerType_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Random_ExternalType_ClassIsland}" />
|
<ComboBoxItem Content="{i18n:I18n Key=Random_ExternalType_ClassIsland}" />
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8" Margin="0,16,0,0" HorizontalAlignment="Center">
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8" Margin="0,16,0,0" HorizontalAlignment="Center">
|
||||||
<ComboBox Name="ComboBoxCallerType" Width="120" Height="50" VerticalAlignment="Center"
|
<ComboBox Name="ComboBoxCallerType" Height="50" VerticalAlignment="Center"
|
||||||
IsEditable="False" IsReadOnly="True" SelectedIndex="0"
|
IsEditable="False" IsReadOnly="True" SelectedIndex="0"
|
||||||
Foreground="{DynamicResource RandWindowTextForeground}">
|
Foreground="{DynamicResource RandWindowTextForeground}">
|
||||||
<ComboBoxItem>ClassIsland点名</ComboBoxItem>
|
<ComboBoxItem>ClassIsland点名</ComboBoxItem>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="Ink_Canvas.ScreenshotSelectorWindow"
|
<Window x:Class="Ink_Canvas.ScreenshotSelectorWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="选择截图区域"
|
Title="选择截图区域"
|
||||||
@@ -258,7 +258,7 @@
|
|||||||
<!-- 分辨率控制 -->
|
<!-- 分辨率控制 -->
|
||||||
<StackPanel Orientation="Horizontal" Margin="4,0">
|
<StackPanel Orientation="Horizontal" Margin="4,0">
|
||||||
<TextBlock Text="分辨率:" Foreground="White" VerticalAlignment="Center" Margin="0,0,4,0" FontSize="12"/>
|
<TextBlock Text="分辨率:" Foreground="White" VerticalAlignment="Center" Margin="0,0,4,0" FontSize="12"/>
|
||||||
<ComboBox Name="ResolutionComboBox" Width="120" Margin="2,0"
|
<ComboBox Name="ResolutionComboBox" Margin="2,0"
|
||||||
Background="#2d2d2d" Foreground="White" BorderBrush="#404040"
|
Background="#2d2d2d" Foreground="White" BorderBrush="#404040"
|
||||||
SelectionChanged="ResolutionComboBox_SelectionChanged">
|
SelectionChanged="ResolutionComboBox_SelectionChanged">
|
||||||
<ComboBoxItem Content="640x480" Tag="640,480"/>
|
<ComboBoxItem Content="640x480" Tag="640,480"/>
|
||||||
|
|||||||
@@ -6,18 +6,14 @@
|
|||||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
|
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
|
||||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||||
xmlns:i18n="clr-namespace:Ink_Canvas.MarkupExtensions"
|
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
Title="基本">
|
Title="基本">
|
||||||
|
|
||||||
<ScrollViewer Padding="59,0,59,0">
|
<ScrollViewer Padding="59,0,59,0">
|
||||||
<!-- These styles can be referenced to create a consistent SettingsPage layout -->
|
|
||||||
<FrameworkElement.Resources>
|
<FrameworkElement.Resources>
|
||||||
<!-- Spacing between cards -->
|
|
||||||
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
|
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
|
||||||
<!-- Style (inc. the correct spacing) of a section header -->
|
|
||||||
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
|
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
|
||||||
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
||||||
TargetType="TextBlock">
|
TargetType="TextBlock">
|
||||||
@@ -30,18 +26,32 @@
|
|||||||
<ikw:SimpleStackPanel MaxWidth="800"
|
<ikw:SimpleStackPanel MaxWidth="800"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Spacing="{StaticResource SettingsCardSpacing}">
|
Spacing="{StaticResource SettingsCardSpacing}">
|
||||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
|
||||||
Text="启动时行为" />
|
|
||||||
|
|
||||||
<ui:SettingsCard
|
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||||
Header="启动设置"
|
Text="基本设置" />
|
||||||
Description="点击跳转到启动设置页面"
|
|
||||||
IsClickEnabled="True"
|
<ItemsControl x:Name="SubPageItems">
|
||||||
Click="SettingsCard_Click">
|
<ItemsControl.ItemsPanel>
|
||||||
<ui:SettingsCard.HeaderIcon>
|
<ItemsPanelTemplate>
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Play}"/>
|
<ikw:SimpleStackPanel Spacing="{StaticResource SettingsCardSpacing}" />
|
||||||
</ui:SettingsCard.HeaderIcon>
|
</ItemsPanelTemplate>
|
||||||
</ui:SettingsCard>
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ui:SettingsCard
|
||||||
|
Header="{Binding Header}"
|
||||||
|
Description="{Binding Description}"
|
||||||
|
IsClickEnabled="True"
|
||||||
|
Click="SubPageCard_Click"
|
||||||
|
Tag="{Binding PageTag}">
|
||||||
|
<ui:SettingsCard.HeaderIcon>
|
||||||
|
<ui:FontIcon Glyph="{Binding IconGlyph}" />
|
||||||
|
</ui:SettingsCard.HeaderIcon>
|
||||||
|
</ui:SettingsCard>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -1,26 +1,95 @@
|
|||||||
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using SWC = System.Windows.Controls;
|
||||||
|
|
||||||
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class SubPageNavItem
|
||||||
/// Basic.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class BasicPage : Page
|
|
||||||
{
|
{
|
||||||
|
public string Header { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string PageTag { get; set; }
|
||||||
|
public string IconGlyph { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class BasicPage : SWC.Page
|
||||||
|
{
|
||||||
|
private readonly ObservableCollection<SubPageNavItem> _subPageItems = new();
|
||||||
|
|
||||||
public BasicPage()
|
public BasicPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
SubPageItems.ItemsSource = _subPageItems;
|
||||||
|
Loaded += BasicPage_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsCard_Click(object sender, RoutedEventArgs e)
|
private void BasicPage_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// 找到SettingsWindow窗口
|
LoadSubPages();
|
||||||
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
}
|
||||||
if (settingsWindow != null)
|
|
||||||
|
private void LoadSubPages()
|
||||||
|
{
|
||||||
|
_subPageItems.Clear();
|
||||||
|
|
||||||
|
var settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
||||||
|
if (settingsWindow == null) return;
|
||||||
|
|
||||||
|
var navView = settingsWindow.GetNavigationView();
|
||||||
|
if (navView == null) return;
|
||||||
|
|
||||||
|
foreach (var item in navView.MenuItems)
|
||||||
{
|
{
|
||||||
// 调用NavigateToPage方法导航到启动页面
|
if (item is NavigationViewItem navItem)
|
||||||
settingsWindow.NavigateToPage("StartupPage");
|
{
|
||||||
|
string tag = navItem.Tag as string;
|
||||||
|
if (tag == "BasicPage" && navItem.MenuItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var child in navItem.MenuItems)
|
||||||
|
{
|
||||||
|
if (child is NavigationViewItem childItem)
|
||||||
|
{
|
||||||
|
string childTag = childItem.Tag as string;
|
||||||
|
if (!string.IsNullOrEmpty(childTag))
|
||||||
|
{
|
||||||
|
string glyph = ExtractIconGlyph(childItem);
|
||||||
|
string description = SWC.ToolTipService.GetToolTip(childItem) as string
|
||||||
|
?? $"点击跳转到{childItem.Content}";
|
||||||
|
|
||||||
|
_subPageItems.Add(new SubPageNavItem
|
||||||
|
{
|
||||||
|
Header = childItem.Content?.ToString() ?? "",
|
||||||
|
Description = description,
|
||||||
|
PageTag = childTag,
|
||||||
|
IconGlyph = glyph
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ExtractIconGlyph(NavigationViewItem navItem)
|
||||||
|
{
|
||||||
|
if (navItem.Icon is FontIcon fontIcon)
|
||||||
|
return fontIcon.Glyph ?? "\uE713";
|
||||||
|
|
||||||
|
if (navItem.Icon is SymbolIcon symbolIcon)
|
||||||
|
return char.ConvertFromUtf32((int)symbolIcon.Symbol);
|
||||||
|
|
||||||
|
return "\uE713";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SubPageCard_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is FrameworkElement element && element.Tag is string pageTag)
|
||||||
|
{
|
||||||
|
var settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
||||||
|
settingsWindow?.NavigateToPage(pageTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@
|
|||||||
TextChanged="BrushAutoRestoreTimesTextBox_TextChanged" />
|
TextChanged="BrushAutoRestoreTimesTextBox_TextChanged" />
|
||||||
</ui:SettingsCard>
|
</ui:SettingsCard>
|
||||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_RestoreColor}">
|
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_RestoreColor}">
|
||||||
<ComboBox x:Name="ComboBoxBrushAutoRestoreColor" Width="200"
|
<ComboBox x:Name="ComboBoxBrushAutoRestoreColor"
|
||||||
SelectionChanged="ComboBoxBrushAutoRestoreColor_SelectionChanged">
|
SelectionChanged="ComboBoxBrushAutoRestoreColor_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Default}" Tag="#FFFF0000" />
|
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Default}" Tag="#FFFF0000" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Black}" Tag="#FF000000" />
|
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Black}" Tag="#FF000000" />
|
||||||
@@ -246,7 +246,7 @@
|
|||||||
|
|
||||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_ShapeEngine}"
|
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_ShapeEngine}"
|
||||||
Description="{i18n:I18n Key=InkRecog_ShapeEngineHint}">
|
Description="{i18n:I18n Key=InkRecog_ShapeEngineHint}">
|
||||||
<ComboBox x:Name="ComboBoxShapeRecognitionEngine" Width="160"
|
<ComboBox x:Name="ComboBoxShapeRecognitionEngine"
|
||||||
SelectionChanged="ComboBoxShapeRecognitionEngine_SelectionChanged">
|
SelectionChanged="ComboBoxShapeRecognitionEngine_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineAuto}" />
|
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineAuto}" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineIACore}" />
|
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineIACore}" />
|
||||||
|
|||||||
@@ -13,11 +13,8 @@
|
|||||||
Title="首页">
|
Title="首页">
|
||||||
|
|
||||||
<ScrollViewer Padding="59,0,59,0">
|
<ScrollViewer Padding="59,0,59,0">
|
||||||
<!-- These styles can be referenced to create a consistent SettingsPage layout -->
|
|
||||||
<FrameworkElement.Resources>
|
<FrameworkElement.Resources>
|
||||||
<!-- Spacing between cards -->
|
|
||||||
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
|
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
|
||||||
<!-- Style (inc. the correct spacing) of a section header -->
|
|
||||||
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
|
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
|
||||||
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
||||||
TargetType="TextBlock">
|
TargetType="TextBlock">
|
||||||
@@ -33,45 +30,27 @@
|
|||||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||||
Text="快速导航" />
|
Text="快速导航" />
|
||||||
|
|
||||||
<ui:SettingsCard
|
<ItemsControl x:Name="QuickNavItems">
|
||||||
Header="基本设置"
|
<ItemsControl.ItemsPanel>
|
||||||
Description="点击跳转到基本设置页面"
|
<ItemsPanelTemplate>
|
||||||
IsClickEnabled="True"
|
<ikw:SimpleStackPanel Spacing="{StaticResource SettingsCardSpacing}" />
|
||||||
Click="SettingsCard_Basic_Click">
|
</ItemsPanelTemplate>
|
||||||
<ui:SettingsCard.HeaderIcon>
|
</ItemsControl.ItemsPanel>
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Home}"/>
|
<ItemsControl.ItemTemplate>
|
||||||
</ui:SettingsCard.HeaderIcon>
|
<DataTemplate>
|
||||||
</ui:SettingsCard>
|
<ui:SettingsCard
|
||||||
|
Header="{Binding Header}"
|
||||||
<ui:SettingsCard
|
Description="{Binding Description}"
|
||||||
Header="页面 2"
|
IsClickEnabled="True"
|
||||||
Description="点击跳转到页面 2"
|
Click="QuickNavCard_Click"
|
||||||
IsClickEnabled="True"
|
Tag="{Binding PageTag}">
|
||||||
Click="SettingsCard_Page2_Click">
|
<ui:SettingsCard.HeaderIcon>
|
||||||
<ui:SettingsCard.HeaderIcon>
|
<ui:FontIcon Glyph="{Binding IconGlyph}" />
|
||||||
<ui:SymbolIcon Symbol="Document" />
|
</ui:SettingsCard.HeaderIcon>
|
||||||
</ui:SettingsCard.HeaderIcon>
|
</ui:SettingsCard>
|
||||||
</ui:SettingsCard>
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
<ui:SettingsCard
|
</ItemsControl>
|
||||||
Header="设计设置"
|
|
||||||
Description="点击跳转到设计设置页面"
|
|
||||||
IsClickEnabled="True"
|
|
||||||
Click="SettingsCard_Design_Click">
|
|
||||||
<ui:SettingsCard.HeaderIcon>
|
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Design}"/>
|
|
||||||
</ui:SettingsCard.HeaderIcon>
|
|
||||||
</ui:SettingsCard>
|
|
||||||
|
|
||||||
<ui:SettingsCard
|
|
||||||
Header="外观设置"
|
|
||||||
Description="点击跳转到外观设置页面"
|
|
||||||
IsClickEnabled="True"
|
|
||||||
Click="SettingsCard_Appearance_Click">
|
|
||||||
<ui:SettingsCard.HeaderIcon>
|
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Color}"/>
|
|
||||||
</ui:SettingsCard.HeaderIcon>
|
|
||||||
</ui:SettingsCard>
|
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -1,59 +1,96 @@
|
|||||||
|
using iNKORE.UI.WPF.Modern.Common.IconKeys;
|
||||||
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class QuickNavItem
|
||||||
/// HomePage.xaml 的交互逻辑
|
|
||||||
/// </summary>
|
|
||||||
public partial class HomePage : Page
|
|
||||||
{
|
{
|
||||||
|
public string Header { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string PageTag { get; set; }
|
||||||
|
public string IconGlyph { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class HomePage
|
||||||
|
{
|
||||||
|
private readonly ObservableCollection<QuickNavItem> _navItems = new();
|
||||||
|
|
||||||
public HomePage()
|
public HomePage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
QuickNavItems.ItemsSource = _navItems;
|
||||||
|
Loaded += HomePage_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsCard_Basic_Click(object sender, RoutedEventArgs e)
|
private void HomePage_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// 找到SettingsWindow窗口
|
LoadNavigationItems();
|
||||||
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
}
|
||||||
if (settingsWindow != null)
|
|
||||||
|
private void LoadNavigationItems()
|
||||||
|
{
|
||||||
|
_navItems.Clear();
|
||||||
|
|
||||||
|
var settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
||||||
|
if (settingsWindow == null) return;
|
||||||
|
|
||||||
|
var navView = settingsWindow.GetNavigationView();
|
||||||
|
if (navView == null) return;
|
||||||
|
|
||||||
|
CollectNavItems(navView.MenuItems);
|
||||||
|
CollectNavItems(navView.FooterMenuItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CollectNavItems(System.Collections.IEnumerable items)
|
||||||
|
{
|
||||||
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
// 调用NavigateToPage方法导航到基本设置页面
|
if (item is NavigationViewItem navItem)
|
||||||
settingsWindow.NavigateToPage("BasicPage");
|
{
|
||||||
|
string tag = navItem.Tag as string;
|
||||||
|
if (!string.IsNullOrEmpty(tag) && tag != "HomePage")
|
||||||
|
{
|
||||||
|
string glyph = ExtractIconGlyph(navItem);
|
||||||
|
string description = System.Windows.Controls.ToolTipService.GetToolTip(navItem) as string
|
||||||
|
?? $"点击跳转到{navItem.Content}";
|
||||||
|
|
||||||
|
_navItems.Add(new QuickNavItem
|
||||||
|
{
|
||||||
|
Header = navItem.Content?.ToString() ?? "",
|
||||||
|
Description = description,
|
||||||
|
PageTag = tag,
|
||||||
|
IconGlyph = glyph
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsCard_Page2_Click(object sender, RoutedEventArgs e)
|
private string ExtractIconGlyph(NavigationViewItem navItem)
|
||||||
{
|
{
|
||||||
// 找到SettingsWindow窗口
|
if (navItem.Icon is FontIcon fontIcon)
|
||||||
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
|
||||||
if (settingsWindow != null)
|
|
||||||
{
|
{
|
||||||
// 调用NavigateToPage方法导航到页面2
|
return fontIcon.Glyph ?? "\uE713";
|
||||||
settingsWindow.NavigateToPage("Page2Page");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (navItem.Icon is SymbolIcon symbolIcon)
|
||||||
|
{
|
||||||
|
return char.ConvertFromUtf32((int)symbolIcon.Symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "\uE713";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SettingsCard_Design_Click(object sender, RoutedEventArgs e)
|
private void QuickNavCard_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// 找到SettingsWindow窗口
|
if (sender is FrameworkElement element && element.Tag is string pageTag)
|
||||||
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
|
||||||
if (settingsWindow != null)
|
|
||||||
{
|
{
|
||||||
// 调用NavigateToPage方法导航到设计设置页面
|
var settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
||||||
settingsWindow.NavigateToPage("DesignPage");
|
settingsWindow?.NavigateToPage(pageTag);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SettingsCard_Appearance_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
// 找到SettingsWindow窗口
|
|
||||||
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
|
|
||||||
if (settingsWindow != null)
|
|
||||||
{
|
|
||||||
// 调用NavigateToPage方法导航到外观设置页面
|
|
||||||
settingsWindow.NavigateToPage("AppearancePage");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,13 +63,13 @@
|
|||||||
<ikw:SimpleStackPanel Orientation="Horizontal">
|
<ikw:SimpleStackPanel Orientation="Horizontal">
|
||||||
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center"
|
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center"
|
||||||
Text="{i18n:I18n Key=Startup_StartTime}" FontSize="14" />
|
Text="{i18n:I18n Key=Startup_StartTime}" FontSize="14" />
|
||||||
<ComboBox x:Name="AutoUpdateWithSilenceStartTimeComboBox" Width="90"
|
<ComboBox x:Name="AutoUpdateWithSilenceStartTimeComboBox"
|
||||||
SelectionChanged="AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged" />
|
SelectionChanged="AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal">
|
<ikw:SimpleStackPanel Orientation="Horizontal">
|
||||||
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center"
|
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center"
|
||||||
Text="{i18n:I18n Key=Startup_EndTime}" FontSize="14" />
|
Text="{i18n:I18n Key=Startup_EndTime}" FontSize="14" />
|
||||||
<ComboBox x:Name="AutoUpdateWithSilenceEndTimeComboBox" Width="90"
|
<ComboBox x:Name="AutoUpdateWithSilenceEndTimeComboBox"
|
||||||
SelectionChanged="AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged" />
|
SelectionChanged="AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<ui:SettingsCard.HeaderIcon>
|
<ui:SettingsCard.HeaderIcon>
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.SyncFolder}" />
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.SyncFolder}" />
|
||||||
</ui:SettingsCard.HeaderIcon>
|
</ui:SettingsCard.HeaderIcon>
|
||||||
<ComboBox x:Name="UpdateChannelSelector" Width="160"
|
<ComboBox x:Name="UpdateChannelSelector"
|
||||||
SelectionChanged="UpdateChannelSelector_SelectionChanged">
|
SelectionChanged="UpdateChannelSelector_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Update_Release}" Tag="Release" />
|
<ComboBoxItem Content="{i18n:I18n Key=Update_Release}" Tag="Release" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Update_Preview}" Tag="Preview" />
|
<ComboBoxItem Content="{i18n:I18n Key=Update_Preview}" Tag="Preview" />
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
<ui:SettingsCard.HeaderIcon>
|
<ui:SettingsCard.HeaderIcon>
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.DeveloperTools}" />
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.DeveloperTools}" />
|
||||||
</ui:SettingsCard.HeaderIcon>
|
</ui:SettingsCard.HeaderIcon>
|
||||||
<ComboBox x:Name="UpdatePackageArchitectureSelector" Width="160"
|
<ComboBox x:Name="UpdatePackageArchitectureSelector"
|
||||||
SelectionChanged="UpdatePackageArchitectureSelector_SelectionChanged">
|
SelectionChanged="UpdatePackageArchitectureSelector_SelectionChanged">
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Update_PackageArch_X86}" Tag="X86" />
|
<ComboBoxItem Content="{i18n:I18n Key=Update_PackageArch_X86}" Tag="X86" />
|
||||||
<ComboBoxItem Content="{i18n:I18n Key=Update_PackageArch_X64}" Tag="X64" />
|
<ComboBoxItem Content="{i18n:I18n Key=Update_PackageArch_X64}" Tag="X64" />
|
||||||
|
|||||||
@@ -481,5 +481,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public NavigationView GetNavigationView()
|
||||||
|
{
|
||||||
|
return NavigationViewControl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user