improve:直接调用外部点名

This commit is contained in:
2025-09-13 12:08:45 +08:00
parent c1fcaff28a
commit 99f9886876
6 changed files with 54 additions and 11 deletions
@@ -1096,20 +1096,37 @@ namespace Ink_Canvas
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardImageOptionsPanel);
// 检查是否启用了直接调用ClassIsland点名功能
// 检查是否启用了外部点名功能
if (Settings.RandSettings.DirectCallCiRand)
{
try
{
string protocol = "";
switch (Settings.RandSettings.ExternalCallerType)
{
case 0: // ClassIsland点名
protocol = "classisland://plugins/IslandCaller/Simple/1";
break;
case 1: // SecRandom点名
protocol = "secrandom://direct_extraction";
break;
case 2: // NamePicker点名
protocol = "namepicker://";
break;
default:
protocol = "classisland://plugins/IslandCaller/Simple/1";
break;
}
Process.Start(new ProcessStartInfo
{
FileName = "classisland://plugins/IslandCaller/Simple/1",
FileName = protocol,
UseShellExecute = true
});
}
catch (Exception ex)
{
MessageBox.Show("无法调用ClassIsland点名:" + ex.Message);
MessageBox.Show("无法调用外部点名:" + ex.Message);
// 调用失败时回退到默认的随机点名窗口
new RandWindow(Settings, true).ShowDialog();
+13 -2
View File
@@ -2417,12 +2417,23 @@ namespace Ink_Canvas
SaveSettingsToFile();
}
private void ToggleSwitchDirectCallCiRand_Toggled(object sender, RoutedEventArgs e)
private void ToggleSwitchExternalCaller_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
// 获取开关状态并保存到设置中
Settings.RandSettings.DirectCallCiRand = ToggleSwitchDirectCallCiRand.IsOn;
Settings.RandSettings.DirectCallCiRand = ToggleSwitchExternalCaller.IsOn;
// 保存设置到文件
SaveSettingsToFile();
}
private void ComboBoxExternalCallerType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!isLoaded) return;
// 获取下拉框选择并保存到设置中
Settings.RandSettings.ExternalCallerType = ComboBoxExternalCallerType.SelectedIndex;
// 保存设置到文件
SaveSettingsToFile();
@@ -763,7 +763,8 @@ namespace Ink_Canvas
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
ToggleSwitchShowRandomAndSingleDraw.IsOn = Settings.RandSettings.ShowRandomAndSingleDraw;
ToggleSwitchDirectCallCiRand.IsOn = Settings.RandSettings.DirectCallCiRand;
ToggleSwitchExternalCaller.IsOn = Settings.RandSettings.DirectCallCiRand;
ComboBoxExternalCallerType.SelectedIndex = Settings.RandSettings.ExternalCallerType;
RandomDrawPanel.Visibility = Settings.RandSettings.ShowRandomAndSingleDraw ? Visibility.Visible : Visibility.Collapsed;
SingleDrawPanel.Visibility = Settings.RandSettings.ShowRandomAndSingleDraw ? Visibility.Visible : Visibility.Collapsed;
@@ -783,7 +784,8 @@ namespace Ink_Canvas
ToggleSwitchDisplayRandWindowNamesInputBtn.IsOn = Settings.RandSettings.DisplayRandWindowNamesInputBtn;
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
ToggleSwitchDirectCallCiRand.IsOn = Settings.RandSettings.DirectCallCiRand;
ToggleSwitchExternalCaller.IsOn = Settings.RandSettings.DirectCallCiRand;
ComboBoxExternalCallerType.SelectedIndex = Settings.RandSettings.ExternalCallerType;
}
// ModeSettings