feat(设置): 新增个性化设置页面并重构主题相关功能
重构主题和语言设置功能,将相关代码从主窗口迁移至新增的个性化设置页面 优化浮动工具栏图标选择逻辑,移除冗余代码 统一设置页面中开关控件的样式和行为 修复设置页面导航项的选择状态问题
This commit is contained in:
@@ -65,7 +65,8 @@
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=About_DeviceInfo}"
|
||||
IsExpanded="True">
|
||||
IsExpanded="True"
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Devices}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
|
||||
@@ -0,0 +1,324 @@
|
||||
<ui:Page x:Class="Ink_Canvas.Windows.SettingsViews.Pages.AppearancePage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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"
|
||||
xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls"
|
||||
mc:Ignorable="d"
|
||||
Title="{i18n:I18n Key=Theme_GroupTitle}">
|
||||
|
||||
<ScrollViewer PanningMode="VerticalFirst">
|
||||
<Grid Margin="59,0,59,0">
|
||||
<FrameworkElement.Resources>
|
||||
<sys:Double x:Key="SettingsCardSpacing">4</sys:Double>
|
||||
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
|
||||
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
||||
TargetType="TextBlock">
|
||||
<Style.Setters>
|
||||
<Setter Property="Margin" Value="1,30,0,6" />
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</FrameworkElement.Resources>
|
||||
<Grid>
|
||||
<ikw:SimpleStackPanel MaxWidth="1000"
|
||||
HorizontalAlignment="Stretch"
|
||||
Spacing="{StaticResource SettingsCardSpacing}">
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Theme_Label}" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_Label}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Pinned}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ComboBox x:Name="ComboBoxTheme"
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxTheme_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Light}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Dark}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_System}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_LanguageLabel}"
|
||||
Description="{i18n:I18n Key=Theme_Language_RestartHint}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Globe}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ComboBox x:Name="ComboBoxLanguage"
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxLanguage_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Language_System}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Language_ChineseSimplified}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Language_English}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Theme_EnableSplash}" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableSplashScreen"
|
||||
Header="{i18n:I18n Key=Theme_EnableSplash}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Photo}"
|
||||
SwitchName="ToggleSwitchEnableSplashScreen"
|
||||
Toggled="ToggleSwitchEnableSplashScreen_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_SplashStyle}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Brightness}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ComboBox x:Name="ComboBoxSplashScreenStyle"
|
||||
SelectedIndex="1"
|
||||
SelectionChanged="ComboBoxSplashScreenStyle_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Random}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Seasonal}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Spring}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Summer}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Autumn}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Winter}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_Splash_Horse}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Theme_FloatingBarIcon}" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_FloatingBarIcon}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Photo}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ComboBox x:Name="ComboBoxFloatingBarImg"
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxFloatingBarImg_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_IccDefault}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_IccNoShadow}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_IccDark}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_IccDarkBreath}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_IccWhiteTransparent}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_IccBlackTransparent}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_CoolapkCrossEye}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_CoolapkAbused}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_CoolapkSmile}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_CoolapkUnderwear}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_CoolapkGreenHatDoge}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_FloatingIcon_TiebaEmoji}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8" Margin="0,4,0,0">
|
||||
<Button x:Name="ButtonAddCustomIcon" Content="{i18n:I18n Key=Theme_Upload}"
|
||||
Click="ButtonAddCustomIcon_Click" Padding="10,3"/>
|
||||
<Button x:Name="ButtonManageCustomIcons" Content="{i18n:I18n Key=Theme_Manage}"
|
||||
Click="ButtonManageCustomIcons_Click" Padding="10,3"/>
|
||||
</ikw:SimpleStackPanel>
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_FloatingBarScale}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Pinned}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Slider x:Name="ViewboxFloatingBarScaleTransformValueSlider" Minimum="0.5"
|
||||
Maximum="1.25" Width="168"
|
||||
IsSnapToTickEnabled="True" Value="1" TickFrequency="0.05"
|
||||
TickPlacement="None" AutoToolTipPlacement="None"
|
||||
ValueChanged="ViewboxFloatingBarScaleTransformValueSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding ElementName=ViewboxFloatingBarScaleTransformValueSlider, Path=Value}"
|
||||
VerticalAlignment="Center" FontFamily="Consolas" Width="40" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_FloatingBarOpacity}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.EaseOfAccess}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityValueSlider" Minimum="0.3"
|
||||
Maximum="1" Width="168"
|
||||
IsSnapToTickEnabled="True" Value="1" TickFrequency="0.05"
|
||||
TickPlacement="None" AutoToolTipPlacement="None"
|
||||
ValueChanged="ViewboxFloatingBarOpacityValueSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding ElementName=ViewboxFloatingBarOpacityValueSlider, Path=Value}"
|
||||
VerticalAlignment="Center" FontFamily="Consolas" Width="40" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_FloatingBarOpacityInPPT}"
|
||||
Description="{i18n:I18n Key=Theme_FloatingBarOpacityInPPTHint}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Play}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityInPPTValueSlider" Minimum="0.3"
|
||||
Maximum="1" Width="168"
|
||||
IsSnapToTickEnabled="True" Value="1" TickFrequency="0.05"
|
||||
TickPlacement="None" AutoToolTipPlacement="None"
|
||||
ValueChanged="ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged" />
|
||||
<TextBlock Text="{Binding ElementName=ViewboxFloatingBarOpacityInPPTValueSlider, Path=Value}"
|
||||
VerticalAlignment="Center" FontFamily="Consolas" Width="40" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableDisPlayNibModeToggle"
|
||||
Header="{i18n:I18n Key=Theme_ShowNibButton}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.TouchPointer}"
|
||||
SwitchName="ToggleSwitchEnableDisPlayNibModeToggle"
|
||||
Toggled="ToggleSwitchEnableDisPlayNibModeToggle_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableViewboxBlackBoardScaleTransform"
|
||||
Header="{i18n:I18n Key=Theme_BlackboardScale80}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.BackToWindow}"
|
||||
SwitchName="ToggleSwitchEnableViewboxBlackBoardScaleTransform"
|
||||
Toggled="ToggleSwitchEnableViewboxBlackBoardScaleTransform_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableTimeDisplayInWhiteboardMode"
|
||||
Header="{i18n:I18n Key=Theme_ShowTimeInWhiteboard}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Pinned}"
|
||||
SwitchName="ToggleSwitchEnableTimeDisplayInWhiteboardMode"
|
||||
Toggled="ToggleSwitchEnableTimeDisplayInWhiteboardMode_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableChickenSoupInWhiteboardMode"
|
||||
Header="{i18n:I18n Key=Theme_ShowQuoteInWhiteboard}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Message}"
|
||||
SwitchName="ToggleSwitchEnableChickenSoupInWhiteboardMode"
|
||||
Toggled="ToggleSwitchEnableChickenSoupInWhiteboardMode_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_QuoteSource}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Heart}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
|
||||
<ComboBox x:Name="ComboBoxChickenSoupSource"
|
||||
Width="240"
|
||||
SelectionChanged="ComboBoxChickenSoupSource_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_QuoteSource_OsuQuotes}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_QuoteSource_Mottos}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_QuoteSource_GaokaoBless}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_QuoteSource_Hitokoto}" />
|
||||
</ComboBox>
|
||||
<Button x:Name="BtnHitokotoCustomize" Content="{i18n:I18n Key=Theme_Customize}"
|
||||
Padding="14,4" MinWidth="65" VerticalAlignment="Center"
|
||||
Click="BtnHitokotoCustomize_Click"
|
||||
Visibility="Collapsed" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableQuickPanel"
|
||||
Header="{i18n:I18n Key=Theme_EnableQuickPanel}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Pinned}"
|
||||
SwitchName="ToggleSwitchEnableQuickPanel"
|
||||
Toggled="ToggleSwitchEnableQuickPanel_Toggled" />
|
||||
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_UnfoldButtonIcon}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.ChevronRight}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ComboBox x:Name="ComboBoxUnFoldBtnImg"
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxUnFoldBtnImg_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_UnfoldIcon_Arrow}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_UnfoldIcon_Pen}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Theme_FloatingBarButtonsTitle}" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardUseLegacyFloatingBarUI"
|
||||
Header="{i18n:I18n Key=Theme_UseLegacyFloatingBarUI}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.History}"
|
||||
SwitchName="ToggleSwitchUseLegacyFloatingBarUI"
|
||||
Toggled="ToggleSwitchUseLegacyFloatingBarUI_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Theme_FloatingBarButtonsTitle}"
|
||||
IsExpanded="True"
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.ViewAll}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowShapeButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowShapeButton}"
|
||||
Checked="CheckBoxShowShapeButton_Changed" Unchecked="CheckBoxShowShapeButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowUndoButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowUndoButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowRedoButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowRedoButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowClearButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowClearButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowWhiteboardButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowWhiteboardButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowHideButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowHideButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowLassoSelectButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowLassoButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowClearAndMouseButton" IsChecked="True"
|
||||
Content="{i18n:I18n Key=Theme_ShowClearAndMouseButton}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox x:Name="CheckBoxShowQuickColorPalette" IsChecked="False"
|
||||
Content="{i18n:I18n Key=Theme_ShowQuickPalette}"
|
||||
Checked="CheckBoxShowButton_Changed" Unchecked="CheckBoxShowButton_Changed" />
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_QuickPaletteMode}">
|
||||
<ComboBox x:Name="ComboBoxQuickColorPaletteDisplayMode"
|
||||
SelectedIndex="1"
|
||||
SelectionChanged="ComboBoxQuickColorPaletteDisplayMode_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_QuickPalette_SingleRow}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_QuickPalette_DoubleRow}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Theme_EraserButtonDisplay}">
|
||||
<ComboBox x:Name="ComboBoxEraserDisplayOption"
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxEraserDisplayOption_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_EraserDisplay_Both}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_EraserDisplay_AreaOnly}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_EraserDisplay_LineOnly}" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Theme_EraserDisplay_None}" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="{i18n:I18n Key=Tray_GroupTitle}" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableTrayIcon"
|
||||
Header="{i18n:I18n Key=Tray_EnableTrayIcon}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Pin}"
|
||||
SwitchName="ToggleSwitchEnableTrayIcon"
|
||||
Toggled="ToggleSwitchEnableTrayIcon_Toggled" />
|
||||
|
||||
<Rectangle Height="48" />
|
||||
</ikw:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</ui:Page>
|
||||
@@ -0,0 +1,513 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using Ink_Canvas.Windows.SettingsViews.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using ContentDialog = iNKORE.UI.WPF.Modern.Controls.ContentDialog;
|
||||
using Page = iNKORE.UI.WPF.Modern.Controls.Page;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
{
|
||||
public partial class AppearancePage : Page
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
private bool _suppressChickenSoupSourceSelectionChanged = false;
|
||||
private bool _isApplyingLanguageFromSettings = false;
|
||||
|
||||
public AppearancePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += Page_Loaded;
|
||||
Unloaded += Page_Unloaded;
|
||||
}
|
||||
|
||||
private void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
private void Page_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_isLoaded = false;
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
var settings = SettingsManager.Settings;
|
||||
if (settings?.Appearance == null) return;
|
||||
|
||||
ComboBoxTheme.SelectedIndex = settings.Appearance.Theme;
|
||||
|
||||
_isApplyingLanguageFromSettings = true;
|
||||
try
|
||||
{
|
||||
var lang = settings.Appearance.Language ?? string.Empty;
|
||||
int langIndex = string.IsNullOrWhiteSpace(lang) ? 0 :
|
||||
string.Equals(lang, "zh-CN", StringComparison.OrdinalIgnoreCase) ? 1 :
|
||||
string.Equals(lang, "en-US", StringComparison.OrdinalIgnoreCase) ? 2 : 0;
|
||||
ComboBoxLanguage.SelectedIndex = langIndex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isApplyingLanguageFromSettings = false;
|
||||
}
|
||||
|
||||
CardEnableSplashScreen.IsOn = settings.Appearance.EnableSplashScreen;
|
||||
ComboBoxSplashScreenStyle.SelectedIndex = settings.Appearance.SplashScreenStyle;
|
||||
|
||||
if (settings.Appearance.FloatingBarImg >= ComboBoxFloatingBarImg.Items.Count)
|
||||
settings.Appearance.FloatingBarImg = 0;
|
||||
ComboBoxFloatingBarImg.SelectedIndex = settings.Appearance.FloatingBarImg;
|
||||
|
||||
if (settings.Appearance.ViewboxFloatingBarScaleTransformValue != 0)
|
||||
ViewboxFloatingBarScaleTransformValueSlider.Value = settings.Appearance.ViewboxFloatingBarScaleTransformValue;
|
||||
|
||||
ViewboxFloatingBarOpacityValueSlider.Value = settings.Appearance.ViewboxFloatingBarOpacityValue;
|
||||
ViewboxFloatingBarOpacityInPPTValueSlider.Value = settings.Appearance.ViewboxFloatingBarOpacityInPPTValue;
|
||||
|
||||
CardEnableDisPlayNibModeToggle.IsOn = settings.Appearance.IsEnableDisPlayNibModeToggler;
|
||||
CardEnableViewboxBlackBoardScaleTransform.IsOn = settings.Appearance.EnableViewboxBlackBoardScaleTransform;
|
||||
CardEnableTimeDisplayInWhiteboardMode.IsOn = settings.Appearance.EnableTimeDisplayInWhiteboardMode;
|
||||
CardEnableChickenSoupInWhiteboardMode.IsOn = settings.Appearance.EnableChickenSoupInWhiteboardMode;
|
||||
|
||||
_suppressChickenSoupSourceSelectionChanged = true;
|
||||
try
|
||||
{
|
||||
ComboBoxChickenSoupSource.SelectedIndex = settings.Appearance.ChickenSoupSource;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Dispatcher.BeginInvoke(
|
||||
(Action)(() => { _suppressChickenSoupSourceSelectionChanged = false; }),
|
||||
DispatcherPriority.ContextIdle);
|
||||
}
|
||||
|
||||
CardEnableQuickPanel.IsOn = settings.Appearance.IsShowQuickPanel;
|
||||
ComboBoxUnFoldBtnImg.SelectedIndex = settings.Appearance.UnFoldButtonImageType;
|
||||
|
||||
CardUseLegacyFloatingBarUI.IsOn = settings.Appearance.UseLegacyFloatingBarUI;
|
||||
CheckBoxShowShapeButton.IsChecked = settings.Appearance.IsShowShapeButton;
|
||||
CheckBoxShowUndoButton.IsChecked = settings.Appearance.IsShowUndoButton;
|
||||
CheckBoxShowRedoButton.IsChecked = settings.Appearance.IsShowRedoButton;
|
||||
CheckBoxShowClearButton.IsChecked = settings.Appearance.IsShowClearButton;
|
||||
CheckBoxShowWhiteboardButton.IsChecked = settings.Appearance.IsShowWhiteboardButton;
|
||||
CheckBoxShowHideButton.IsChecked = settings.Appearance.IsShowHideButton;
|
||||
CheckBoxShowLassoSelectButton.IsChecked = settings.Appearance.IsShowLassoSelectButton;
|
||||
CheckBoxShowClearAndMouseButton.IsChecked = settings.Appearance.IsShowClearAndMouseButton;
|
||||
CheckBoxShowQuickColorPalette.IsChecked = settings.Appearance.IsShowQuickColorPalette;
|
||||
ComboBoxQuickColorPaletteDisplayMode.SelectedIndex = settings.Appearance.QuickColorPaletteDisplayMode;
|
||||
ComboBoxEraserDisplayOption.SelectedIndex = settings.Appearance.EraserDisplayOption;
|
||||
|
||||
CardEnableTrayIcon.IsOn = settings.Appearance.EnableTrayIcon;
|
||||
}
|
||||
|
||||
private MainWindow GetMainWindow() => Application.Current.MainWindow as MainWindow;
|
||||
|
||||
#region Theme & Language
|
||||
|
||||
private void ComboBoxTheme_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
try
|
||||
{
|
||||
SettingsManager.Settings.Appearance.Theme = ComboBoxTheme.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.ApplyTheme(ComboBoxTheme.SelectedIndex);
|
||||
}
|
||||
catch (Exception ex) { Debug.WriteLine($"切换主题时出错: {ex.Message}"); }
|
||||
}
|
||||
|
||||
private void ComboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded || _isApplyingLanguageFromSettings) return;
|
||||
try
|
||||
{
|
||||
var index = ComboBoxLanguage.SelectedIndex;
|
||||
string language = index switch
|
||||
{
|
||||
1 => "zh-CN",
|
||||
2 => "en-US",
|
||||
_ => string.Empty
|
||||
};
|
||||
SettingsManager.Settings.Appearance.Language = language;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
LocalizationHelper.TrySetCulture(language);
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null)
|
||||
{
|
||||
mw._isReloadingForLanguageChange = true;
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var newWindow = new MainWindow
|
||||
{
|
||||
WindowState = mw.WindowState,
|
||||
Left = mw.Left,
|
||||
Top = mw.Top
|
||||
};
|
||||
newWindow.Show();
|
||||
mw.Close();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Debug.WriteLine($"重建主窗口以应用语言时出错: {ex2.Message}");
|
||||
mw._isReloadingForLanguageChange = false;
|
||||
}
|
||||
}), DispatcherPriority.ApplicationIdle);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { Debug.WriteLine($"切换界面语言时出错: {ex.Message}"); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Splash Screen
|
||||
|
||||
private void ToggleSwitchEnableSplashScreen_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.EnableSplashScreen = CardEnableSplashScreen.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ComboBoxSplashScreenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.SplashScreenStyle = ComboBoxSplashScreenStyle.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Floating Bar Appearance
|
||||
|
||||
private void ComboBoxFloatingBarImg_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.FloatingBarImg = ComboBoxFloatingBarImg.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.UpdateFloatingBarIcon();
|
||||
}
|
||||
|
||||
private void ButtonAddCustomIcon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var mw = GetMainWindow();
|
||||
if (mw == null) return;
|
||||
AddCustomIconWindow dialog = new AddCustomIconWindow(mw);
|
||||
dialog.Owner = mw;
|
||||
dialog.ShowDialog();
|
||||
if (dialog.IsSuccess)
|
||||
{
|
||||
ComboBoxFloatingBarImg.SelectedIndex = ComboBoxFloatingBarImg.Items.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonManageCustomIcons_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var mw = GetMainWindow();
|
||||
if (mw == null) return;
|
||||
CustomIconWindow dialog = new CustomIconWindow(mw);
|
||||
dialog.Owner = mw;
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
var val = ViewboxFloatingBarScaleTransformValueSlider.Value;
|
||||
SettingsManager.Settings.Appearance.ViewboxFloatingBarScaleTransformValue = val;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null)
|
||||
{
|
||||
mw.ViewboxFloatingBarScaleTransform.ScaleX = val > 0.5 && val < 1.25 ? val : val <= 0.5 ? 0.5 : 1.25;
|
||||
mw.ViewboxFloatingBarScaleTransform.ScaleY = val > 0.5 && val < 1.25 ? val : val <= 0.5 ? 0.5 : 1.25;
|
||||
}
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarOpacityValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.ViewboxFloatingBarOpacityValue = ViewboxFloatingBarOpacityValueSlider.Value;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.ViewboxFloatingBar.Opacity = ViewboxFloatingBarOpacityValueSlider.Value;
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.ViewboxFloatingBarOpacityInPPTValue = ViewboxFloatingBarOpacityInPPTValueSlider.Value;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Display Options
|
||||
|
||||
private void ToggleSwitchEnableDisPlayNibModeToggle_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.IsEnableDisPlayNibModeToggler = CardEnableDisPlayNibModeToggle.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null)
|
||||
{
|
||||
var vis = CardEnableDisPlayNibModeToggle.IsOn ? Visibility.Visible : Visibility.Collapsed;
|
||||
mw.NibModeSimpleStackPanel.Visibility = vis;
|
||||
mw.BoardNibModeSimpleStackPanel.Visibility = vis;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableViewboxBlackBoardScaleTransform_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.EnableViewboxBlackBoardScaleTransform = CardEnableViewboxBlackBoardScaleTransform.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null)
|
||||
{
|
||||
var scale = CardEnableViewboxBlackBoardScaleTransform.IsOn ? 0.8 : 1.0;
|
||||
mw.ViewboxBlackboardCenterSideScaleTransform.ScaleX = scale;
|
||||
mw.ViewboxBlackboardCenterSideScaleTransform.ScaleY = scale;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableTimeDisplayInWhiteboardMode_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.EnableTimeDisplayInWhiteboardMode = CardEnableTimeDisplayInWhiteboardMode.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null && mw.currentMode == 1)
|
||||
{
|
||||
var vis = CardEnableTimeDisplayInWhiteboardMode.IsOn ? Visibility.Visible : Visibility.Collapsed;
|
||||
mw.WaterMarkTime.Visibility = vis;
|
||||
mw.WaterMarkDate.Visibility = vis;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableChickenSoupInWhiteboardMode_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.EnableChickenSoupInWhiteboardMode = CardEnableChickenSoupInWhiteboardMode.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null && mw.currentMode == 1 && CardEnableTimeDisplayInWhiteboardMode.IsOn)
|
||||
{
|
||||
mw.BlackBoardWaterMark.Visibility = CardEnableChickenSoupInWhiteboardMode.IsOn ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private async void ComboBoxChickenSoupSource_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (_suppressChickenSoupSourceSelectionChanged || !_isLoaded) return;
|
||||
int idx = ComboBoxChickenSoupSource.SelectedIndex;
|
||||
if (idx < 0) return;
|
||||
if (SettingsManager.Settings.Appearance.ChickenSoupSource == idx) return;
|
||||
SettingsManager.Settings.Appearance.ChickenSoupSource = idx;
|
||||
if (BtnHitokotoCustomize != null)
|
||||
BtnHitokotoCustomize.Visibility = idx == 3 ? Visibility.Visible : Visibility.Collapsed;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) await mw.UpdateChickenSoupTextAsync();
|
||||
}
|
||||
|
||||
private async void BtnHitokotoCustomize_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var categories = new System.Collections.Generic.Dictionary<string, string>
|
||||
{
|
||||
{ "a", "动画" }, { "b", "漫画" }, { "c", "游戏" }, { "d", "文学" },
|
||||
{ "e", "原创" }, { "f", "来自网络" }, { "g", "其他" }, { "h", "影视" },
|
||||
{ "i", "诗词" }, { "j", "网易云" }, { "k", "哲学" }, { "l", "抖机灵" }
|
||||
};
|
||||
|
||||
var contentPanel = new StackPanel { Margin = new Thickness(20), Orientation = Orientation.Vertical };
|
||||
var selectAllCheckBox = new CheckBox { Content = "全选", FontSize = 14, Margin = new Thickness(0, 0, 0, 8) };
|
||||
var categoryCheckBoxes = new System.Collections.Generic.Dictionary<string, CheckBox>();
|
||||
var savedHitokoto = SettingsManager.Settings.Appearance.HitokotoCategories;
|
||||
bool implicitAllCategories = savedHitokoto == null || savedHitokoto.Count == 0;
|
||||
|
||||
foreach (var category in categories)
|
||||
{
|
||||
var checkBox = new CheckBox
|
||||
{
|
||||
Content = category.Value, Tag = category.Key, FontSize = 13,
|
||||
IsChecked = implicitAllCategories || savedHitokoto.Contains(category.Key),
|
||||
Margin = new Thickness(0, 0, 0, 8)
|
||||
};
|
||||
categoryCheckBoxes[category.Key] = checkBox;
|
||||
contentPanel.Children.Add(checkBox);
|
||||
}
|
||||
|
||||
bool isUpdatingSelectAll = false;
|
||||
selectAllCheckBox.IsChecked = implicitAllCategories || savedHitokoto.Count == categories.Count;
|
||||
selectAllCheckBox.Checked += (s, args) => { if (isUpdatingSelectAll) return; isUpdatingSelectAll = true; foreach (var cb in categoryCheckBoxes.Values) cb.IsChecked = true; isUpdatingSelectAll = false; };
|
||||
selectAllCheckBox.Unchecked += (s, args) => { if (isUpdatingSelectAll) return; isUpdatingSelectAll = true; foreach (var cb in categoryCheckBoxes.Values) cb.IsChecked = false; isUpdatingSelectAll = false; };
|
||||
foreach (var cb in categoryCheckBoxes.Values)
|
||||
{
|
||||
cb.Checked += (s, args) => { if (isUpdatingSelectAll) return; isUpdatingSelectAll = true; selectAllCheckBox.IsChecked = categoryCheckBoxes.Values.All(c => c.IsChecked == true); isUpdatingSelectAll = false; };
|
||||
cb.Unchecked += (s, args) => { if (isUpdatingSelectAll) return; isUpdatingSelectAll = true; selectAllCheckBox.IsChecked = false; isUpdatingSelectAll = false; };
|
||||
}
|
||||
|
||||
var mainPanel = new StackPanel();
|
||||
mainPanel.Children.Add(selectAllCheckBox);
|
||||
mainPanel.Children.Add(new Separator { Margin = new Thickness(0, 8, 0, 8) });
|
||||
mainPanel.Children.Add(contentPanel);
|
||||
|
||||
var mw = GetMainWindow();
|
||||
var contentDialog = new ContentDialog
|
||||
{
|
||||
Title = "自定义一言分类",
|
||||
Content = new ScrollViewer { Content = mainPanel, MaxHeight = 400, VerticalScrollBarVisibility = ScrollBarVisibility.Auto },
|
||||
PrimaryButtonText = "确定",
|
||||
SecondaryButtonText = "取消",
|
||||
DefaultButton = ContentDialogButton.Primary,
|
||||
Owner = mw
|
||||
};
|
||||
|
||||
var dialogResult = await contentDialog.ShowAsync();
|
||||
if (dialogResult == ContentDialogResult.Primary)
|
||||
{
|
||||
SettingsManager.Settings.Appearance.HitokotoCategories = categoryCheckBoxes.Where(kvp => kvp.Value.IsChecked == true).Select(kvp => kvp.Key).ToList();
|
||||
if (SettingsManager.Settings.Appearance.HitokotoCategories.Count == 0)
|
||||
SettingsManager.Settings.Appearance.HitokotoCategories = categories.Keys.ToList();
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
if (SettingsManager.Settings.Appearance.ChickenSoupSource == 3 && SettingsManager.Settings.Appearance.EnableChickenSoupInWhiteboardMode)
|
||||
{
|
||||
if (mw != null) await mw.UpdateChickenSoupTextAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableQuickPanel_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.IsShowQuickPanel = CardEnableQuickPanel.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ComboBoxUnFoldBtnImg_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.UnFoldButtonImageType = ComboBoxUnFoldBtnImg.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null)
|
||||
{
|
||||
if (ComboBoxUnFoldBtnImg.SelectedIndex == 0)
|
||||
{
|
||||
mw.RightUnFoldBtnImgChevron.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/new-icons/unfold-chevron.png"));
|
||||
mw.RightUnFoldBtnImgChevron.Width = 14; mw.RightUnFoldBtnImgChevron.Height = 14;
|
||||
mw.RightUnFoldBtnImgChevron.RenderTransform = new RotateTransform(180);
|
||||
mw.LeftUnFoldBtnImgChevron.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/new-icons/unfold-chevron.png"));
|
||||
mw.LeftUnFoldBtnImgChevron.Width = 14; mw.LeftUnFoldBtnImgChevron.Height = 14;
|
||||
mw.LeftUnFoldBtnImgChevron.RenderTransform = null;
|
||||
}
|
||||
else if (ComboBoxUnFoldBtnImg.SelectedIndex == 1)
|
||||
{
|
||||
mw.RightUnFoldBtnImgChevron.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/new-icons/pen-white.png"));
|
||||
mw.RightUnFoldBtnImgChevron.Width = 18; mw.RightUnFoldBtnImgChevron.Height = 18;
|
||||
mw.RightUnFoldBtnImgChevron.RenderTransform = null;
|
||||
mw.LeftUnFoldBtnImgChevron.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/new-icons/pen-white.png"));
|
||||
mw.LeftUnFoldBtnImgChevron.Width = 18; mw.LeftUnFoldBtnImgChevron.Height = 18;
|
||||
mw.LeftUnFoldBtnImgChevron.RenderTransform = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Floating Bar Buttons
|
||||
|
||||
private void ToggleSwitchUseLegacyFloatingBarUI_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.UseLegacyFloatingBarUI = CardUseLegacyFloatingBarUI.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.UpdateFloatingBarIcons();
|
||||
}
|
||||
|
||||
private void CheckBoxShowShapeButton_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.IsShowShapeButton = CheckBoxShowShapeButton.IsChecked ?? false;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.UpdateFloatingBarButtonsVisibility();
|
||||
}
|
||||
|
||||
private void CheckBoxShowButton_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (sender == CheckBoxShowUndoButton)
|
||||
SettingsManager.Settings.Appearance.IsShowUndoButton = CheckBoxShowUndoButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowRedoButton)
|
||||
SettingsManager.Settings.Appearance.IsShowRedoButton = CheckBoxShowRedoButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowClearButton)
|
||||
SettingsManager.Settings.Appearance.IsShowClearButton = CheckBoxShowClearButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowWhiteboardButton)
|
||||
SettingsManager.Settings.Appearance.IsShowWhiteboardButton = CheckBoxShowWhiteboardButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowHideButton)
|
||||
SettingsManager.Settings.Appearance.IsShowHideButton = CheckBoxShowHideButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowLassoSelectButton)
|
||||
SettingsManager.Settings.Appearance.IsShowLassoSelectButton = CheckBoxShowLassoSelectButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowClearAndMouseButton)
|
||||
SettingsManager.Settings.Appearance.IsShowClearAndMouseButton = CheckBoxShowClearAndMouseButton.IsChecked ?? false;
|
||||
else if (sender == CheckBoxShowQuickColorPalette)
|
||||
SettingsManager.Settings.Appearance.IsShowQuickColorPalette = CheckBoxShowQuickColorPalette.IsChecked ?? false;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.UpdateFloatingBarButtonsVisibility();
|
||||
}
|
||||
|
||||
private void ComboBoxQuickColorPaletteDisplayMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.QuickColorPaletteDisplayMode = ComboBoxQuickColorPaletteDisplayMode.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.UpdateFloatingBarButtonsVisibility();
|
||||
}
|
||||
|
||||
private void ComboBoxEraserDisplayOption_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.EraserDisplayOption = ComboBoxEraserDisplayOption.SelectedIndex;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
var mw = GetMainWindow();
|
||||
if (mw != null) mw.UpdateFloatingBarButtonsVisibility();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tray Icon
|
||||
|
||||
private void ToggleSwitchEnableTrayIcon_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Appearance.EnableTrayIcon = CardEnableTrayIcon.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
try
|
||||
{
|
||||
var _taskbar = Application.Current.Resources["TaskbarTrayIcon"];
|
||||
if (_taskbar is FrameworkElement fe)
|
||||
fe.Visibility = CardEnableTrayIcon.IsOn ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -133,20 +133,17 @@
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableInkFade"
|
||||
<ui:SettingsExpander x:Name="ExpanderEnableInkFade"
|
||||
Header="{i18n:I18n Key=Canvas_EnableInkFade}"
|
||||
Description="{i18n:I18n Key=Canvas_EnableInkFadeHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Color}"
|
||||
SwitchName="ToggleSwitchEnableInkFade"
|
||||
Toggled="ToggleSwitchEnableInkFade_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Canvas_EnableInkFade}"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableInkFade, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableInkFade, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Color}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:ToggleSwitch x:Name="ToggleSwitchEnableInkFade"
|
||||
OnContent="{DynamicResource Common_On}"
|
||||
OffContent="{DynamicResource Common_Off}"
|
||||
Toggled="ToggleSwitchEnableInkFade_Toggled" />
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_InkFadeTime}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
@@ -167,20 +164,17 @@
|
||||
SwitchName="ToggleSwitchHideInkFadeControlInPenMenu"
|
||||
Toggled="ToggleSwitchHideInkFadeControlInPenMenu_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardBrushAutoRestore"
|
||||
<ui:SettingsExpander x:Name="ExpanderBrushAutoRestore"
|
||||
Header="{i18n:I18n Key=Canvas_BrushAutoRestore}"
|
||||
Description="{i18n:I18n Key=Canvas_BrushAutoRestoreHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Refresh}"
|
||||
SwitchName="ToggleSwitchBrushAutoRestore"
|
||||
Toggled="ToggleSwitchBrushAutoRestore_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Canvas_BrushAutoRestore}"
|
||||
Visibility="{Binding IsOn, ElementName=CardBrushAutoRestore, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardBrushAutoRestore, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:ToggleSwitch x:Name="ToggleSwitchBrushAutoRestore"
|
||||
OnContent="{DynamicResource Common_On}"
|
||||
OffContent="{DynamicResource Common_Off}"
|
||||
Toggled="ToggleSwitchBrushAutoRestore_Toggled" />
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_AutoRestoreTimePoints}">
|
||||
<TextBox x:Name="BrushAutoRestoreTimesTextBox" Width="260"
|
||||
@@ -221,20 +215,17 @@
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnableEraserAutoSwitchBack"
|
||||
<ui:SettingsExpander x:Name="ExpanderEnableEraserAutoSwitchBack"
|
||||
Header="{i18n:I18n Key=Canvas_SwitchBackAfterEraser}"
|
||||
Description="{i18n:I18n Key=Canvas_SwitchBackAfterEraserHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Switch}"
|
||||
SwitchName="ToggleSwitchEnableEraserAutoSwitchBack"
|
||||
Toggled="ToggleSwitchEnableEraserAutoSwitchBack_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Canvas_SwitchBackAfterEraser}"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableEraserAutoSwitchBack, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableEraserAutoSwitchBack, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Switch}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:ToggleSwitch x:Name="ToggleSwitchEnableEraserAutoSwitchBack"
|
||||
OnContent="{DynamicResource Common_On}"
|
||||
OffContent="{DynamicResource Common_Off}"
|
||||
Toggled="ToggleSwitchEnableEraserAutoSwitchBack_Toggled" />
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Canvas_SwitchBackDelay}"
|
||||
Description="{i18n:I18n Key=Canvas_SwitchBackDelayHint}">
|
||||
@@ -266,20 +257,17 @@
|
||||
SwitchName="ToggleSwitchEnableTwoFingerRotationOnSelection"
|
||||
Toggled="ToggleSwitchEnableTwoFingerRotationOnSelection_Toggled" />
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardEnablePalmEraser"
|
||||
<ui:SettingsExpander x:Name="ExpanderEnablePalmEraser"
|
||||
Header="{i18n:I18n Key=Gesture_EnablePalmEraser}"
|
||||
Description="{i18n:I18n Key=Gesture_PalmHint}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.EraseTool}"
|
||||
SwitchName="ToggleSwitchEnablePalmEraser"
|
||||
Toggled="ToggleSwitchEnablePalmEraser_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=Gesture_EnablePalmEraser}"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnablePalmEraser, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnablePalmEraser, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.EraseTool}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:ToggleSwitch x:Name="ToggleSwitchEnablePalmEraser"
|
||||
OnContent="{DynamicResource Common_On}"
|
||||
OffContent="{DynamicResource Common_Off}"
|
||||
Toggled="ToggleSwitchEnablePalmEraser_Toggled" />
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=Gesture_PalmSensitivity}">
|
||||
<ComboBox x:Name="ComboBoxPalmEraserSensitivity"
|
||||
|
||||
@@ -46,15 +46,15 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
if (settings.Canvas.UseAdvancedBezierSmoothing) curveMode = 2;
|
||||
else if (settings.Canvas.FitToCurve) curveMode = 1;
|
||||
ComboBoxCurveSmoothingMode.SelectedIndex = curveMode;
|
||||
CardEnableInkFade.IsOn = settings.Canvas.EnableInkFade;
|
||||
ToggleSwitchEnableInkFade.IsOn = settings.Canvas.EnableInkFade;
|
||||
InkFadeTimeSlider.Value = settings.Canvas.InkFadeTime;
|
||||
CardHideInkFadeControlInPenMenu.IsOn = settings.Canvas.HideInkFadeControlInPenMenu;
|
||||
CardBrushAutoRestore.IsOn = settings.Canvas.EnableBrushAutoRestore;
|
||||
ToggleSwitchBrushAutoRestore.IsOn = settings.Canvas.EnableBrushAutoRestore;
|
||||
BrushAutoRestoreTimesTextBox.Text = settings.Canvas.BrushAutoRestoreTimes ?? string.Empty;
|
||||
LoadBrushAutoRestoreColor(settings.Canvas.BrushAutoRestoreColor);
|
||||
BrushAutoRestoreWidthSlider.Value = settings.Canvas.BrushAutoRestoreWidth > 0 ? settings.Canvas.BrushAutoRestoreWidth : 5;
|
||||
BrushAutoRestoreAlphaSlider.Value = settings.Canvas.BrushAutoRestoreAlpha;
|
||||
CardEnableEraserAutoSwitchBack.IsOn = settings.Canvas.EnableEraserAutoSwitchBack;
|
||||
ToggleSwitchEnableEraserAutoSwitchBack.IsOn = settings.Canvas.EnableEraserAutoSwitchBack;
|
||||
EraserAutoSwitchBackDelaySlider.Value = settings.Canvas.EraserAutoSwitchBackDelaySeconds;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
|
||||
if (settings.Canvas != null)
|
||||
{
|
||||
CardEnablePalmEraser.IsOn = settings.Canvas.EnablePalmEraser;
|
||||
ToggleSwitchEnablePalmEraser.IsOn = settings.Canvas.EnablePalmEraser;
|
||||
ComboBoxPalmEraserSensitivity.SelectedIndex = settings.Canvas.PalmEraserSensitivity;
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,11 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
|
||||
ExpanderEnableInkFade.IsExpanded = ToggleSwitchEnableInkFade.IsOn;
|
||||
ExpanderBrushAutoRestore.IsExpanded = ToggleSwitchBrushAutoRestore.IsOn;
|
||||
ExpanderEnableEraserAutoSwitchBack.IsExpanded = ToggleSwitchEnableEraserAutoSwitchBack.IsOn;
|
||||
ExpanderEnablePalmEraser.IsExpanded = ToggleSwitchEnablePalmEraser.IsOn;
|
||||
}
|
||||
|
||||
private void LoadBrushAutoRestoreColor(string hex)
|
||||
@@ -213,7 +218,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
private void ToggleSwitchEnableInkFade_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.EnableInkFade = CardEnableInkFade.IsOn;
|
||||
SettingsManager.Settings.Canvas.EnableInkFade = ToggleSwitchEnableInkFade.IsOn;
|
||||
ExpanderEnableInkFade.IsExpanded = ToggleSwitchEnableInkFade.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
@@ -234,7 +240,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
private void ToggleSwitchBrushAutoRestore_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.EnableBrushAutoRestore = CardBrushAutoRestore.IsOn;
|
||||
SettingsManager.Settings.Canvas.EnableBrushAutoRestore = ToggleSwitchBrushAutoRestore.IsOn;
|
||||
ExpanderBrushAutoRestore.IsExpanded = ToggleSwitchBrushAutoRestore.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
@@ -273,7 +280,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
private void ToggleSwitchEnableEraserAutoSwitchBack_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.EnableEraserAutoSwitchBack = CardEnableEraserAutoSwitchBack.IsOn;
|
||||
SettingsManager.Settings.Canvas.EnableEraserAutoSwitchBack = ToggleSwitchEnableEraserAutoSwitchBack.IsOn;
|
||||
ExpanderEnableEraserAutoSwitchBack.IsExpanded = ToggleSwitchEnableEraserAutoSwitchBack.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
@@ -301,7 +309,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
private void ToggleSwitchEnablePalmEraser_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.EnablePalmEraser = CardEnablePalmEraser.IsOn;
|
||||
SettingsManager.Settings.Canvas.EnablePalmEraser = ToggleSwitchEnablePalmEraser.IsOn;
|
||||
ExpanderEnablePalmEraser.IsExpanded = ToggleSwitchEnablePalmEraser.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,13 @@
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Pinned}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Header="个性化" Description="个性化设置"
|
||||
IsClickEnabled="True" Click="QuickNavCard_Click" Tag="AppearancePage">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Personalize}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
|
||||
Text="其他" />
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
<ui:SettingsExpander x:Name="settingsCard" VerticalAlignment="Top"
|
||||
Description="The SettingsExpander has the same properties as a Card, and you can set SettingsCard as part of the Items collection."
|
||||
Header="SettingsExpander" IsEnabled="True"
|
||||
IsExpanded="True">
|
||||
IsExpanded="True"
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Glyph=""/>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<ui:SettingsExpander Header="形状修正"
|
||||
Visibility="{Binding IsOn, ElementName=CardEnableInkToShape, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardEnableInkToShape, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
@@ -97,19 +97,16 @@
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardAutoStraightenLine"
|
||||
<ui:SettingsExpander x:Name="ExpanderAutoStraightenLine"
|
||||
Header="{i18n:I18n Key=InkRecog_AutoStraightLine}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.LineDisplay}"
|
||||
SwitchName="ToggleSwitchAutoStraightenLine"
|
||||
Toggled="ToggleSwitchAutoStraightenLine_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=InkRecog_AutoStraightLine}"
|
||||
Visibility="{Binding IsOn, ElementName=CardAutoStraightenLine, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardAutoStraightenLine, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.LineDisplay}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:ToggleSwitch x:Name="ToggleSwitchAutoStraightenLine"
|
||||
OnContent="{DynamicResource Common_On}"
|
||||
OffContent="{DynamicResource Common_Off}"
|
||||
Toggled="ToggleSwitchAutoStraightenLine_Toggled" />
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_LengthThreshold}">
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
@@ -138,19 +135,16 @@
|
||||
</ui:SettingsExpander.Items>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<controls:LabeledSettingsCard x:Name="CardLineEndpointSnapping"
|
||||
<ui:SettingsExpander x:Name="ExpanderLineEndpointSnapping"
|
||||
Header="{i18n:I18n Key=InkRecog_LineEndpointSnapping}"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Link}"
|
||||
SwitchName="ToggleSwitchLineEndpointSnapping"
|
||||
Toggled="ToggleSwitchLineEndpointSnapping_Toggled" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=InkRecog_LineEndpointSnapping}"
|
||||
Visibility="{Binding IsOn, ElementName=CardLineEndpointSnapping, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardLineEndpointSnapping, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Link}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
<ui:ToggleSwitch x:Name="ToggleSwitchLineEndpointSnapping"
|
||||
OnContent="{DynamicResource Common_On}"
|
||||
OffContent="{DynamicResource Common_Off}"
|
||||
Toggled="ToggleSwitchLineEndpointSnapping_Toggled" />
|
||||
<ui:SettingsExpander.Items>
|
||||
<ui:SettingsCard Header="{i18n:I18n Key=InkRecog_SnappingDistance}"
|
||||
Description="{i18n:I18n Key=InkRecog_LineEndpointSnappingHint}">
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
|
||||
if (settings.Canvas != null)
|
||||
{
|
||||
CardAutoStraightenLine.IsOn = settings.Canvas.AutoStraightenLine;
|
||||
ToggleSwitchAutoStraightenLine.IsOn = settings.Canvas.AutoStraightenLine;
|
||||
AutoStraightenLineThresholdSlider.Value = settings.Canvas.AutoStraightenLineThreshold;
|
||||
CheckboxHighPrecisionLineStraighten.IsChecked = settings.Canvas.HighPrecisionLineStraighten;
|
||||
CardLineEndpointSnapping.IsOn = settings.Canvas.LineEndpointSnapping;
|
||||
ToggleSwitchLineEndpointSnapping.IsOn = settings.Canvas.LineEndpointSnapping;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -60,6 +60,9 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
|
||||
ExpanderAutoStraightenLine.IsExpanded = ToggleSwitchAutoStraightenLine.IsOn;
|
||||
ExpanderLineEndpointSnapping.IsExpanded = ToggleSwitchLineEndpointSnapping.IsOn;
|
||||
}
|
||||
|
||||
private void ToggleSwitchEnableInkToShape_Toggled(object sender, RoutedEventArgs e)
|
||||
@@ -124,7 +127,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
private void ToggleSwitchAutoStraightenLine_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.AutoStraightenLine = CardAutoStraightenLine.IsOn;
|
||||
SettingsManager.Settings.Canvas.AutoStraightenLine = ToggleSwitchAutoStraightenLine.IsOn;
|
||||
ExpanderAutoStraightenLine.IsExpanded = ToggleSwitchAutoStraightenLine.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
@@ -152,7 +156,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
private void ToggleSwitchLineEndpointSnapping_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
SettingsManager.Settings.Canvas.LineEndpointSnapping = CardLineEndpointSnapping.IsOn;
|
||||
SettingsManager.Settings.Canvas.LineEndpointSnapping = ToggleSwitchLineEndpointSnapping.IsOn;
|
||||
ExpanderLineEndpointSnapping.IsExpanded = ToggleSwitchLineEndpointSnapping.IsOn;
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
Text="{i18n:I18n Key=About_PrivacyAndTelemetry}" />
|
||||
|
||||
<ui:SettingsExpander Header="{i18n:I18n Key=About_PrivacyAndTelemetry}"
|
||||
IsExpanded="True">
|
||||
IsExpanded="True"
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Shield}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
|
||||
@@ -89,14 +89,11 @@
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Warning}" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="12">
|
||||
<RadioButton x:Name="RadioCrashSilentRestart" GroupName="CrashAction"
|
||||
Content="{i18n:I18n Key=Crash_SilentRestart}"
|
||||
Checked="RadioCrashAction_Checked" />
|
||||
<RadioButton x:Name="RadioCrashNoAction" GroupName="CrashAction"
|
||||
Content="{i18n:I18n Key=Crash_NoAction}"
|
||||
Checked="RadioCrashAction_Checked" />
|
||||
</ikw:SimpleStackPanel>
|
||||
<ComboBox x:Name="ComboBoxCrashAction"
|
||||
SelectionChanged="ComboBoxCrashAction_SelectionChanged">
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Crash_SilentRestart}" Tag="0" />
|
||||
<ComboBoxItem Content="{i18n:I18n Key=Crash_NoAction}" Tag="1" />
|
||||
</ComboBox>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<!-- 底部空白 -->
|
||||
|
||||
@@ -50,14 +50,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
{
|
||||
CardEnableNibMode.IsOn = settings.Startup.IsEnableNibMode;
|
||||
|
||||
if (settings.Startup.CrashAction == 0)
|
||||
{
|
||||
RadioCrashSilentRestart.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RadioCrashNoAction.IsChecked = true;
|
||||
}
|
||||
ComboBoxCrashAction.SelectedIndex = settings.Startup.CrashAction;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -203,21 +196,25 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
|
||||
|
||||
#region 崩溃后操作事件处理
|
||||
|
||||
private void RadioCrashAction_Checked(object sender, RoutedEventArgs e)
|
||||
private void ComboBoxCrashAction_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
try
|
||||
{
|
||||
if (RadioCrashSilentRestart != null && RadioCrashSilentRestart.IsChecked == true)
|
||||
var item = ComboBoxCrashAction?.SelectedItem as ComboBoxItem;
|
||||
if (item == null) return;
|
||||
var tag = item.Tag?.ToString() ?? "0";
|
||||
switch (tag)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.SilentRestart;
|
||||
SettingsManager.Settings.Startup.CrashAction = 0;
|
||||
}
|
||||
else if (RadioCrashNoAction != null && RadioCrashNoAction.IsChecked == true)
|
||||
{
|
||||
App.CrashAction = App.CrashActionType.NoAction;
|
||||
SettingsManager.Settings.Startup.CrashAction = 1;
|
||||
case "0":
|
||||
App.CrashAction = App.CrashActionType.SilentRestart;
|
||||
SettingsManager.Settings.Startup.CrashAction = 0;
|
||||
break;
|
||||
case "1":
|
||||
App.CrashAction = App.CrashActionType.NoAction;
|
||||
SettingsManager.Settings.Startup.CrashAction = 1;
|
||||
break;
|
||||
}
|
||||
SettingsManager.SaveSettingsToFile();
|
||||
App.SyncCrashActionFromSettings();
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
Header="{i18n:I18n Key=Startup_SilentUpdateTimePeriod}"
|
||||
Visibility="{Binding IsOn, ElementName=CardSilentUpdate, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsExpanded="{Binding IsOn, ElementName=CardSilentUpdate, Mode=OneWay}"
|
||||
d:Visibility="Visible">
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
<ui:SettingsExpander x:Name="ExpanderAlwaysOnTop"
|
||||
Header="{i18n:I18n Key=Startup_TopMost}"
|
||||
Description="{i18n:I18n Key=Startup_TopMostHint}"
|
||||
IsExpanded="{Binding IsOn, ElementName=ToggleSwitchAlwaysOnTop, Mode=OneWay}">
|
||||
IsExpanded="{Binding IsOn, ElementName=ToggleSwitchAlwaysOnTop, Mode=OneWay}"
|
||||
d:Visibility="Visible" d:IsExpanded="True">
|
||||
<ui:SettingsExpander.HeaderIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Pinned}" />
|
||||
</ui:SettingsExpander.HeaderIcon>
|
||||
|
||||
Reference in New Issue
Block a user