This commit is contained in:
PrefacedCorg
2026-04-24 07:13:27 +08:00
parent f05062f902
commit 48b0e09278
10 changed files with 215 additions and 115 deletions
+5 -5
View File
@@ -686,7 +686,7 @@
Visibility="{Binding ElementName=ToggleSwitchEnablePalmEraser, Path=IsOn, Converter={StaticResource BooleanToVisibilityConverter}}">
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Gesture_PalmSensitivity}" VerticalAlignment="Center"
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_PalmSensitivityMedium}" />
<ComboBoxItem Content="{i18n:I18n Key=Gesture_PalmSensitivityHigh}" />
@@ -2180,7 +2180,7 @@
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,5,0,0">
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Backup_Interval}" VerticalAlignment="Center"
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">
<ComboBoxItem Content="{i18n:I18n Key=Backup_Interval_1Day}" Tag="1" />
<ComboBoxItem Content="{i18n:I18n Key=Backup_Interval_3Days}" Tag="3" />
@@ -2208,7 +2208,7 @@
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=ConfigProfiles_Label}" VerticalAlignment="Center"
FontSize="14" Margin="0,0,8,0" />
<ComboBox x:Name="ComboBoxConfigProfile" Width="220" MinWidth="180"
<ComboBox x:Name="ComboBoxConfigProfile" MinWidth="180"
SelectionChanged="ComboBoxConfigProfile_SelectionChanged" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
@@ -2857,7 +2857,7 @@
<ikw:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#a1a1aa" Text="{i18n:I18n Key=Storage_AutoSaveInterval}" VerticalAlignment="Center"
FontSize="12" Margin="0,0,16,0" />
<ComboBox Name="ComboBoxAutoSaveStrokesInterval" Width="120"
<ComboBox Name="ComboBoxAutoSaveStrokesInterval"
SelectionChanged="ComboBoxAutoSaveStrokesInterval_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Storage_AutoSaveInterval_1Min}" Tag="1" />
<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">
<TextBlock Foreground="#fafafa" Text="{i18n:I18n Key=Random_ExternalTypeLabel}"
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"
SelectionChanged="ComboBoxExternalCallerType_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Random_ExternalType_ClassIsland}" />
+1 -1
View File
@@ -106,7 +106,7 @@
</ikw:SimpleStackPanel>
</Border>
<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"
Foreground="{DynamicResource RandWindowTextForeground}">
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="选择截图区域"
@@ -258,7 +258,7 @@
<!-- 分辨率控制 -->
<StackPanel Orientation="Horizontal" Margin="4,0">
<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"
SelectionChanged="ResolutionComboBox_SelectionChanged">
<ComboBoxItem Content="640x480" Tag="640,480"/>
@@ -6,18 +6,14 @@
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
xmlns:i18n="clr-namespace:Ink_Canvas.MarkupExtensions"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="基本">
<ScrollViewer Padding="59,0,59,0">
<!-- These styles can be referenced to create a consistent SettingsPage layout -->
<FrameworkElement.Resources>
<!-- Spacing between cards -->
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
<!-- Style (inc. the correct spacing) of a section header -->
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
@@ -30,18 +26,32 @@
<ikw:SimpleStackPanel MaxWidth="800"
HorizontalAlignment="Stretch"
Spacing="{StaticResource SettingsCardSpacing}">
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="启动时行为" />
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="基本设置" />
<ItemsControl x:Name="SubPageItems">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ikw:SimpleStackPanel Spacing="{StaticResource SettingsCardSpacing}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ui:SettingsCard
Header="启动设置"
Description="点击跳转到启动设置页面"
Header="{Binding Header}"
Description="{Binding Description}"
IsClickEnabled="True"
Click="SettingsCard_Click">
Click="SubPageCard_Click"
Tag="{Binding PageTag}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Play}"/>
<ui:FontIcon Glyph="{Binding IconGlyph}" />
</ui:SettingsCard.HeaderIcon>
</ui:SettingsCard>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ikw:SimpleStackPanel>
</Grid>
</ScrollViewer>
@@ -1,26 +1,95 @@
using iNKORE.UI.WPF.Modern.Controls;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using SWC = System.Windows.Controls;
namespace Ink_Canvas.Windows.SettingsViews.Pages
{
/// <summary>
/// Basic.xaml 的交互逻辑
/// </summary>
public partial class BasicPage : Page
public class SubPageNavItem
{
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()
{
InitializeComponent();
SubPageItems.ItemsSource = _subPageItems;
Loaded += BasicPage_Loaded;
}
private void SettingsCard_Click(object sender, RoutedEventArgs e)
private void BasicPage_Loaded(object sender, RoutedEventArgs e)
{
// 找到SettingsWindow窗口
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
if (settingsWindow != null)
LoadSubPages();
}
private void LoadSubPages()
{
// 调用NavigateToPage方法导航到启动页面
settingsWindow.NavigateToPage("StartupPage");
_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)
{
if (item is NavigationViewItem navItem)
{
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" />
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_RestoreColor}">
<ComboBox x:Name="ComboBoxBrushAutoRestoreColor" Width="200"
<ComboBox x:Name="ComboBoxBrushAutoRestoreColor"
SelectionChanged="ComboBoxBrushAutoRestoreColor_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Default}" Tag="#FFFF0000" />
<ComboBoxItem Content="{i18n:I18n Key=Canvas_Color_Black}" Tag="#FF000000" />
@@ -246,7 +246,7 @@
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_ShapeEngine}"
Description="{i18n:I18n Key=InkRecog_ShapeEngineHint}">
<ComboBox x:Name="ComboBoxShapeRecognitionEngine" Width="160"
<ComboBox x:Name="ComboBoxShapeRecognitionEngine"
SelectionChanged="ComboBoxShapeRecognitionEngine_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineAuto}" />
<ComboBoxItem Content="{i18n:I18n Key=InkRecog_ShapeEngineIACore}" />
@@ -13,11 +13,8 @@
Title="首页">
<ScrollViewer Padding="59,0,59,0">
<!-- These styles can be referenced to create a consistent SettingsPage layout -->
<FrameworkElement.Resources>
<!-- Spacing between cards -->
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
<!-- Style (inc. the correct spacing) of a section header -->
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
@@ -33,45 +30,27 @@
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="快速导航" />
<ItemsControl x:Name="QuickNavItems">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ikw:SimpleStackPanel Spacing="{StaticResource SettingsCardSpacing}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ui:SettingsCard
Header="基本设置"
Description="点击跳转到基本设置页面"
Header="{Binding Header}"
Description="{Binding Description}"
IsClickEnabled="True"
Click="SettingsCard_Basic_Click">
Click="QuickNavCard_Click"
Tag="{Binding PageTag}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Home}"/>
</ui:SettingsCard.HeaderIcon>
</ui:SettingsCard>
<ui:SettingsCard
Header="页面 2"
Description="点击跳转到页面 2"
IsClickEnabled="True"
Click="SettingsCard_Page2_Click">
<ui:SettingsCard.HeaderIcon>
<ui:SymbolIcon Symbol="Document" />
</ui:SettingsCard.HeaderIcon>
</ui:SettingsCard>
<ui:SettingsCard
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:FontIcon Glyph="{Binding IconGlyph}" />
</ui:SettingsCard.HeaderIcon>
</ui:SettingsCard>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ikw:SimpleStackPanel>
</Grid>
</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.Controls;
using System.Windows.Media;
namespace Ink_Canvas.Windows.SettingsViews.Pages
{
/// <summary>
/// HomePage.xaml 的交互逻辑
/// </summary>
public partial class HomePage : Page
public class QuickNavItem
{
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()
{
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窗口
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
if (settingsWindow != null)
LoadNavigationItems();
}
private void LoadNavigationItems()
{
// 调用NavigateToPage方法导航到基本设置页面
settingsWindow.NavigateToPage("BasicPage");
_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)
{
if (item is NavigationViewItem navItem)
{
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窗口
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
if (settingsWindow != null)
if (navItem.Icon is FontIcon fontIcon)
{
// 调用NavigateToPage方法导航到页面2
settingsWindow.NavigateToPage("Page2Page");
}
return fontIcon.Glyph ?? "\uE713";
}
private void SettingsCard_Design_Click(object sender, RoutedEventArgs e)
if (navItem.Icon is SymbolIcon symbolIcon)
{
// 找到SettingsWindow窗口
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
if (settingsWindow != null)
{
// 调用NavigateToPage方法导航到设计设置页面
settingsWindow.NavigateToPage("DesignPage");
}
return char.ConvertFromUtf32((int)symbolIcon.Symbol);
}
private void SettingsCard_Appearance_Click(object sender, RoutedEventArgs e)
return "\uE713";
}
private void QuickNavCard_Click(object sender, RoutedEventArgs e)
{
// 找到SettingsWindow窗口
SettingsWindow settingsWindow = Window.GetWindow(this) as SettingsWindow;
if (settingsWindow != null)
if (sender is FrameworkElement element && element.Tag is string pageTag)
{
// 调用NavigateToPage方法导航到外观设置页面
settingsWindow.NavigateToPage("AppearancePage");
var settingsWindow = Window.GetWindow(this) as SettingsWindow;
settingsWindow?.NavigateToPage(pageTag);
}
}
}
@@ -63,13 +63,13 @@
<ikw:SimpleStackPanel Orientation="Horizontal">
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center"
Text="{i18n:I18n Key=Startup_StartTime}" FontSize="14" />
<ComboBox x:Name="AutoUpdateWithSilenceStartTimeComboBox" Width="90"
<ComboBox x:Name="AutoUpdateWithSilenceStartTimeComboBox"
SelectionChanged="AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Orientation="Horizontal">
<TextBlock Margin="0,0,10,0" VerticalAlignment="Center"
Text="{i18n:I18n Key=Startup_EndTime}" FontSize="14" />
<ComboBox x:Name="AutoUpdateWithSilenceEndTimeComboBox" Width="90"
<ComboBox x:Name="AutoUpdateWithSilenceEndTimeComboBox"
SelectionChanged="AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel>
@@ -87,7 +87,7 @@
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.SyncFolder}" />
</ui:SettingsCard.HeaderIcon>
<ComboBox x:Name="UpdateChannelSelector" Width="160"
<ComboBox x:Name="UpdateChannelSelector"
SelectionChanged="UpdateChannelSelector_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Update_Release}" Tag="Release" />
<ComboBoxItem Content="{i18n:I18n Key=Update_Preview}" Tag="Preview" />
@@ -100,7 +100,7 @@
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.DeveloperTools}" />
</ui:SettingsCard.HeaderIcon>
<ComboBox x:Name="UpdatePackageArchitectureSelector" Width="160"
<ComboBox x:Name="UpdatePackageArchitectureSelector"
SelectionChanged="UpdatePackageArchitectureSelector_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Update_PackageArch_X86}" Tag="X86" />
<ComboBoxItem Content="{i18n:I18n Key=Update_PackageArch_X64}" Tag="X64" />
@@ -481,5 +481,10 @@ namespace Ink_Canvas.Windows.SettingsViews
}
}
#endregion
public NavigationView GetNavigationView()
{
return NavigationViewControl;
}
}
}