diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 48a621a3..7238863e 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -3299,6 +3299,62 @@ FontFamily="Consolas" Text="{Binding ElementName=RandWindowOnceMaxStudentsSlider, Path=Value, Converter={StaticResource IntNumberToString}}" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // 使用延迟确保窗口完全显示后再强制置顶 + randWindow.Dispatcher.BeginInvoke(new Action(() => { try { @@ -1126,6 +1135,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"强制置顶RandWindow失败: {ex.Message}", LogHelper.LogType.Error); } }), DispatcherPriority.Loaded); + } } public void CheckEraserTypeTab() @@ -1232,14 +1242,30 @@ namespace Ink_Canvas { MessageBox.Show("无法调用外部点名:" + ex.Message); - // 调用失败时回退到默认的随机点名窗口 - new RandWindow(Settings, true).ShowDialog(); + // 调用失败时回退到相应的点名窗口 + if (Settings.RandSettings.UseNewRollCallUI) + { + new NewStyleRollCallWindow(Settings, true).ShowDialog(); // 单次抽模式 + } + else + { + new RandWindow(Settings, true).ShowDialog(); + } } } else { - // 使用默认的随机点名窗口 - new RandWindow(Settings, true).ShowDialog(); + // 根据设置决定使用哪个点名窗口 + if (Settings.RandSettings.UseNewRollCallUI) + { + // 使用新点名UI - 单次抽模式 + new NewStyleRollCallWindow(Settings, true).ShowDialog(); + } + else + { + // 使用默认的随机点名窗口 + new RandWindow(Settings, true).ShowDialog(); + } } } diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index e5e06c8f..c494bda9 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -2671,6 +2671,35 @@ namespace Ink_Canvas SaveSettingsToFile(); } + // 新点名UI设置事件处理 + private void ToggleSwitchUseNewRollCallUI_Toggled(object sender, RoutedEventArgs e) + { + if (!isLoaded) return; + Settings.RandSettings.UseNewRollCallUI = ToggleSwitchUseNewRollCallUI.IsOn; + SaveSettingsToFile(); + } + + private void ToggleSwitchEnableMLAvoidance_Toggled(object sender, RoutedEventArgs e) + { + if (!isLoaded) return; + Settings.RandSettings.EnableMLAvoidance = ToggleSwitchEnableMLAvoidance.IsOn; + SaveSettingsToFile(); + } + + private void MLAvoidanceHistorySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (!isLoaded) return; + Settings.RandSettings.MLAvoidanceHistoryCount = (int)MLAvoidanceHistorySlider.Value; + SaveSettingsToFile(); + } + + private void MLAvoidanceWeightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (!isLoaded) return; + Settings.RandSettings.MLAvoidanceWeight = MLAvoidanceWeightSlider.Value; + SaveSettingsToFile(); + } + private void ProgressiveReminderVolumeSlider_ValueChanged(object sender, RoutedEventArgs e) { if (!isLoaded) return; diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs index c9699bb8..93d50998 100644 --- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs +++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs @@ -886,6 +886,12 @@ namespace Ink_Canvas ToggleSwitchUseNewStyleUI.IsOn = Settings.RandSettings.UseNewStyleUI; ToggleSwitchEnableOvertimeCountUp.IsOn = Settings.RandSettings.EnableOvertimeCountUp; + // 新点名UI设置 + ToggleSwitchUseNewRollCallUI.IsOn = Settings.RandSettings.UseNewRollCallUI; + ToggleSwitchEnableMLAvoidance.IsOn = Settings.RandSettings.EnableMLAvoidance; + MLAvoidanceHistorySlider.Value = Settings.RandSettings.MLAvoidanceHistoryCount; + MLAvoidanceWeightSlider.Value = Settings.RandSettings.MLAvoidanceWeight; + bool canEnableRedText = Settings.RandSettings.EnableOvertimeCountUp && Settings.RandSettings.EnableOvertimeRedText; ToggleSwitchEnableOvertimeRedText.IsOn = canEnableRedText; if (!canEnableRedText) diff --git a/Ink Canvas/Resources/NewRollCallWindowResources.xaml b/Ink Canvas/Resources/NewRollCallWindowResources.xaml new file mode 100644 index 00000000..0eceb7f8 --- /dev/null +++ b/Ink Canvas/Resources/NewRollCallWindowResources.xaml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs index ba633b85..9929a55d 100644 --- a/Ink Canvas/Resources/Settings.cs +++ b/Ink Canvas/Resources/Settings.cs @@ -650,6 +650,14 @@ namespace Ink_Canvas public double ProgressiveReminderVolume { get; set; } = 1.0; [JsonProperty("progressiveReminderSoundPath")] public string ProgressiveReminderSoundPath { get; set; } = ""; + [JsonProperty("useNewRollCallUI")] + public bool UseNewRollCallUI { get; set; } = true; + [JsonProperty("enableMLAvoidance")] + public bool EnableMLAvoidance { get; set; } = true; + [JsonProperty("mlAvoidanceHistoryCount")] + public int MLAvoidanceHistoryCount { get; set; } = 20; + [JsonProperty("mlAvoidanceWeight")] + public double MLAvoidanceWeight { get; set; } = 0.8; } public class CustomPickNameBackground diff --git a/Ink Canvas/Windows/NamesInputWindow.xaml b/Ink Canvas/Windows/NamesInputWindow.xaml index f397f495..0c9add60 100644 --- a/Ink Canvas/Windows/NamesInputWindow.xaml +++ b/Ink Canvas/Windows/NamesInputWindow.xaml @@ -5,15 +5,40 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Ink_Canvas" mc:Ignorable="d" FontFamily="Microsoft YaHei UI" ui:WindowHelper.UseModernWindowStyle="True" - ui:ThemeManager.RequestedTheme="Light" WindowStartupLocation="CenterScreen" + WindowStartupLocation="CenterScreen" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" Topmost="True" Title="Ink Canvas 抽奖 - 名单导入" Height="500" Width="400" Loaded="Window_Loaded" Closing="Window_Closing"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +