Files
community/Ink Canvas/Windows/SettingsViews/Pages/RandomDrawPage.xaml
T
PrefacedCorg 24cbaf69ea refactor(UI): 使用 LabeledSettingsCard 替换 SettingsCard 和 ToggleSwitch 组合
统一设置页面中的开关控件样式,将原有的 SettingsCard 和 ToggleSwitch 组合替换为自定义的 LabeledSettingsCard 控件,简化 XAML 结构并保持功能不变
2026-04-25 20:54:26 +08:00

196 lines
11 KiB
XML

<ui:Page x:Class="Ink_Canvas.Windows.SettingsViews.Pages.RandomDrawPage"
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=Random_Title}">
<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=Random_Title}" />
<controls:LabeledSettingsCard x:Name="ToggleSwitchDisplayRandWindowNamesInputBtn"
Header="{i18n:I18n Key=Random_ShowEditNamesButton}"
Icon="{x:Static ui:SegoeFluentIcons.Edit}"
IsOn="True"
Toggled="ToggleSwitchDisplayRandWindowNamesInputBtn_OnToggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchShowRandomAndSingleDraw"
Header="{i18n:I18n Key=Random_EnableButtons}"
IsOn="True"
Toggled="ToggleSwitchShowRandomAndSingleDraw_Toggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchEnableQuickDraw"
Header="{i18n:I18n Key=Random_EnableQuickButton}"
IsOn="True"
Toggled="ToggleSwitchEnableQuickDraw_Toggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchExternalCaller"
Header="{i18n:I18n Key=Random_UseExternal}"
IsOn="False"
Toggled="ToggleSwitchExternalCaller_Toggled"/>
<ui:SettingsCard Header="{i18n:I18n Key=Random_ExternalTypeLabel}">
<ComboBox x:Name="ComboBoxExternalCallerType"
SelectedIndex="0"
SelectionChanged="ComboBoxExternalCallerType_SelectionChanged">
<ComboBoxItem Content="{i18n:I18n Key=Random_ExternalType_ClassIsland}" />
<ComboBoxItem Content="{i18n:I18n Key=Random_ExternalType_SecRandom}" />
<ComboBoxItem Content="{i18n:I18n Key=Random_ExternalType_NamePicker}" />
</ComboBox>
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Random_OnceCloseDelay}">
<Slider x:Name="RandWindowOnceCloseLatencySlider"
Minimum="0.5" Maximum="8" Width="200"
IsSnapToTickEnabled="True" Value="2.5"
TickFrequency="0.1" TickPlacement="None"
ValueChanged="RandWindowOnceCloseLatencySlider_ValueChanged" />
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Random_OnceMaxStudents}">
<Slider x:Name="RandWindowOnceMaxStudentsSlider"
Minimum="0" Maximum="20" Width="200"
IsSnapToTickEnabled="True" Value="10" TickFrequency="1"
TickPlacement="None"
ValueChanged="RandWindowOnceMaxStudentsSlider_ValueChanged" />
</ui:SettingsCard>
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="{i18n:I18n Key=Random_BackgroundSettingsTitle}" />
<ui:SettingsCard Header="{i18n:I18n Key=Random_BackgroundSelectLabel}">
<ComboBox x:Name="ComboBoxPickNameBackground"
SelectedIndex="0"
SelectionChanged="ComboBoxPickNameBackground_SelectionChanged" />
</ui:SettingsCard>
<ui:SettingsCard ContentAlignment="Left">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
<Button x:Name="ButtonAddCustomBackground" Content="{i18n:I18n Key=Random_CustomBackground_Upload}" Click="ButtonAddCustomBackground_Click" />
<Button x:Name="ButtonManageBackgrounds" Content="{i18n:I18n Key=Random_CustomBackground_Manage}" Click="ButtonManageBackgrounds_Click" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="{i18n:I18n Key=Random_NewUI_Title}" />
<controls:LabeledSettingsCard x:Name="ToggleSwitchUseNewRollCallUI"
Header="{i18n:I18n Key=Random_NewUI_Enable}"
IsOn="True"
Toggled="ToggleSwitchUseNewRollCallUI_Toggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchEnableMLAvoidance"
Header="{i18n:I18n Key=Random_ML_AvoidRepeat}"
IsOn="True"
Toggled="ToggleSwitchEnableMLAvoidance_Toggled"/>
<ui:SettingsCard Header="{i18n:I18n Key=Random_ML_HistoryCount}">
<Slider x:Name="MLAvoidanceHistorySlider"
Minimum="5" Maximum="50" Width="200"
IsSnapToTickEnabled="True" Value="50" TickFrequency="5"
TickPlacement="None"
ValueChanged="MLAvoidanceHistorySlider_ValueChanged" />
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Random_ML_Weight}">
<Slider x:Name="MLAvoidanceWeightSlider"
Minimum="0.1" Maximum="1.0" Width="200"
IsSnapToTickEnabled="True" Value="1.0" TickFrequency="0.1"
TickPlacement="None"
ValueChanged="MLAvoidanceWeightSlider_ValueChanged" />
</ui:SettingsCard>
<TextBlock Text="{i18n:I18n Key=Random_ML_Hint}"
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
TextWrapping="Wrap" Margin="1,0,0,4" />
<TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"
Text="{i18n:I18n Key=Timer_Title}" />
<controls:LabeledSettingsCard x:Name="ToggleSwitchUseLegacyTimerUI"
Header="{i18n:I18n Key=Timer_UseLegacyButtons}"
IsOn="False"
Toggled="ToggleSwitchUseLegacyTimerUI_Toggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchUseNewStyleUI"
Header="{i18n:I18n Key=Timer_NewUI}"
IsOn="False"
Toggled="ToggleSwitchUseNewStyleUI_Toggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchEnableOvertimeCountUp"
Header="{i18n:I18n Key=Timer_EnableCountUp}"
IsOn="False"
Toggled="ToggleSwitchEnableOvertimeCountUp_Toggled"/>
<controls:LabeledSettingsCard x:Name="ToggleSwitchEnableOvertimeRedText"
Header="{i18n:I18n Key=Timer_OvertimeHighlight}"
IsOn="True"
Toggled="ToggleSwitchEnableOvertimeRedText_Toggled"/>
<ui:SettingsCard Header="{i18n:I18n Key=Timer_Volume}">
<Slider x:Name="TimerVolumeSlider"
Minimum="0" Maximum="1" Width="200"
IsSnapToTickEnabled="True" Value="1" TickFrequency="0.1"
TickPlacement="None"
ValueChanged="TimerVolumeSlider_ValueChanged" />
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Timer_CustomSoundLabel}">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
<Button x:Name="ButtonSelectCustomTimerSound" Content="{i18n:I18n Key=Timer_SelectFile}" Click="ButtonSelectCustomTimerSound_Click" />
<Button x:Name="ButtonResetTimerSound" Content="{i18n:I18n Key=Timer_Reset}" Click="ButtonResetTimerSound_Click" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
<controls:LabeledSettingsCard x:Name="ToggleSwitchEnableProgressiveReminder"
Header="{i18n:I18n Key=Timer_Progressive}"
IsOn="False"
Toggled="ToggleSwitchEnableProgressiveReminder_Toggled"/>
<ui:SettingsCard Header="{i18n:I18n Key=Timer_ProgressiveVolume}">
<Slider x:Name="ProgressiveReminderVolumeSlider"
Minimum="0" Maximum="1" Width="200"
IsSnapToTickEnabled="True" Value="1" TickFrequency="0.1"
TickPlacement="None"
ValueChanged="ProgressiveReminderVolumeSlider_ValueChanged" />
</ui:SettingsCard>
<ui:SettingsCard Header="{i18n:I18n Key=Timer_ProgressiveCustomLabel}">
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="8">
<Button x:Name="ButtonSelectCustomProgressiveReminderSound" Content="{i18n:I18n Key=Timer_ProgressiveSelectFile}" Click="ButtonSelectCustomProgressiveReminderSound_Click" />
<Button x:Name="ButtonResetProgressiveReminderSound" Content="{i18n:I18n Key=Timer_ProgressiveReset}" Click="ButtonResetProgressiveReminderSound_Click" />
</ikw:SimpleStackPanel>
</ui:SettingsCard>
<Rectangle Height="48" />
</ikw:SimpleStackPanel>
</Grid>
</Grid>
</ScrollViewer>
</ui:Page>