improve:直接调用外部点名
This commit is contained in:
@@ -2928,13 +2928,24 @@
|
||||
Toggled="ToggleSwitchShowRandomAndSingleDraw_Toggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#fafafa" Text="直接调用Ci点名"
|
||||
<TextBlock Foreground="#fafafa" Text="直接调用外部点名"
|
||||
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
||||
<ui:ToggleSwitch OnContent="" OffContent=""
|
||||
Name="ToggleSwitchDirectCallCiRand"
|
||||
Name="ToggleSwitchExternalCaller"
|
||||
IsOn="False" FontFamily="Microsoft YaHei UI"
|
||||
FontWeight="Bold"
|
||||
Toggled="ToggleSwitchDirectCallCiRand_Toggled" />
|
||||
Toggled="ToggleSwitchExternalCaller_Toggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
||||
<TextBlock Foreground="#fafafa" Text="点名类型"
|
||||
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
||||
<ComboBox Name="ComboBoxExternalCallerType" Width="150" Height="30"
|
||||
IsEditable="False" IsReadOnly="True" SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxExternalCallerType_SelectionChanged">
|
||||
<ComboBoxItem>ClassIsland点名</ComboBoxItem>
|
||||
<ComboBoxItem>SecRandom点名</ComboBoxItem>
|
||||
<ComboBoxItem>NamePicker点名</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</ui:SimpleStackPanel>
|
||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
||||
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
// 新增:每一页一个Canvas对象
|
||||
// 每一页一个Canvas对象
|
||||
private List<System.Windows.Controls.Canvas> whiteboardPages = new List<System.Windows.Controls.Canvas>();
|
||||
private int currentPageIndex;
|
||||
private System.Windows.Controls.Canvas currentCanvas;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -548,6 +548,8 @@ namespace Ink_Canvas
|
||||
public bool ShowRandomAndSingleDraw { get; set; } = true;
|
||||
[JsonProperty("directCallCiRand")]
|
||||
public bool DirectCallCiRand { get; set; }
|
||||
[JsonProperty("externalCallerType")]
|
||||
public int ExternalCallerType { get; set; } = 0;
|
||||
[JsonProperty("selectedBackgroundIndex")]
|
||||
public int SelectedBackgroundIndex { get; set; }
|
||||
[JsonProperty("customPickNameBackgrounds")]
|
||||
|
||||
Reference in New Issue
Block a user