improve:直接调用外部点名
This commit is contained in:
@@ -2928,13 +2928,24 @@
|
|||||||
Toggled="ToggleSwitchShowRandomAndSingleDraw_Toggled" />
|
Toggled="ToggleSwitchShowRandomAndSingleDraw_Toggled" />
|
||||||
</ui:SimpleStackPanel>
|
</ui:SimpleStackPanel>
|
||||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
<TextBlock Foreground="#fafafa" Text="直接调用Ci点名"
|
<TextBlock Foreground="#fafafa" Text="直接调用外部点名"
|
||||||
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
||||||
<ui:ToggleSwitch OnContent="" OffContent=""
|
<ui:ToggleSwitch OnContent="" OffContent=""
|
||||||
Name="ToggleSwitchDirectCallCiRand"
|
Name="ToggleSwitchExternalCaller"
|
||||||
IsOn="False" FontFamily="Microsoft YaHei UI"
|
IsOn="False" FontFamily="Microsoft YaHei UI"
|
||||||
FontWeight="Bold"
|
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>
|
</ui:SimpleStackPanel>
|
||||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
||||||
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
// 新增:每一页一个Canvas对象
|
// 每一页一个Canvas对象
|
||||||
private List<System.Windows.Controls.Canvas> whiteboardPages = new List<System.Windows.Controls.Canvas>();
|
private List<System.Windows.Controls.Canvas> whiteboardPages = new List<System.Windows.Controls.Canvas>();
|
||||||
private int currentPageIndex;
|
private int currentPageIndex;
|
||||||
private System.Windows.Controls.Canvas currentCanvas;
|
private System.Windows.Controls.Canvas currentCanvas;
|
||||||
|
|||||||
@@ -1096,20 +1096,37 @@ namespace Ink_Canvas
|
|||||||
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
|
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
|
||||||
AnimationsHelper.HideWithSlideAndFade(BoardImageOptionsPanel);
|
AnimationsHelper.HideWithSlideAndFade(BoardImageOptionsPanel);
|
||||||
|
|
||||||
// 检查是否启用了直接调用ClassIsland点名功能
|
// 检查是否启用了外部点名功能
|
||||||
if (Settings.RandSettings.DirectCallCiRand)
|
if (Settings.RandSettings.DirectCallCiRand)
|
||||||
{
|
{
|
||||||
try
|
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
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "classisland://plugins/IslandCaller/Simple/1",
|
FileName = protocol,
|
||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("无法调用ClassIsland点名:" + ex.Message);
|
MessageBox.Show("无法调用外部点名:" + ex.Message);
|
||||||
|
|
||||||
// 调用失败时回退到默认的随机点名窗口
|
// 调用失败时回退到默认的随机点名窗口
|
||||||
new RandWindow(Settings, true).ShowDialog();
|
new RandWindow(Settings, true).ShowDialog();
|
||||||
|
|||||||
@@ -2417,12 +2417,23 @@ namespace Ink_Canvas
|
|||||||
SaveSettingsToFile();
|
SaveSettingsToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleSwitchDirectCallCiRand_Toggled(object sender, RoutedEventArgs e)
|
private void ToggleSwitchExternalCaller_Toggled(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!isLoaded) return;
|
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();
|
SaveSettingsToFile();
|
||||||
|
|||||||
@@ -763,7 +763,8 @@ namespace Ink_Canvas
|
|||||||
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
|
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
|
||||||
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
|
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
|
||||||
ToggleSwitchShowRandomAndSingleDraw.IsOn = Settings.RandSettings.ShowRandomAndSingleDraw;
|
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;
|
RandomDrawPanel.Visibility = Settings.RandSettings.ShowRandomAndSingleDraw ? Visibility.Visible : Visibility.Collapsed;
|
||||||
SingleDrawPanel.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;
|
ToggleSwitchDisplayRandWindowNamesInputBtn.IsOn = Settings.RandSettings.DisplayRandWindowNamesInputBtn;
|
||||||
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
|
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
|
||||||
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
|
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
|
||||||
ToggleSwitchDirectCallCiRand.IsOn = Settings.RandSettings.DirectCallCiRand;
|
ToggleSwitchExternalCaller.IsOn = Settings.RandSettings.DirectCallCiRand;
|
||||||
|
ComboBoxExternalCallerType.SelectedIndex = Settings.RandSettings.ExternalCallerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModeSettings
|
// ModeSettings
|
||||||
|
|||||||
@@ -548,6 +548,8 @@ namespace Ink_Canvas
|
|||||||
public bool ShowRandomAndSingleDraw { get; set; } = true;
|
public bool ShowRandomAndSingleDraw { get; set; } = true;
|
||||||
[JsonProperty("directCallCiRand")]
|
[JsonProperty("directCallCiRand")]
|
||||||
public bool DirectCallCiRand { get; set; }
|
public bool DirectCallCiRand { get; set; }
|
||||||
|
[JsonProperty("externalCallerType")]
|
||||||
|
public int ExternalCallerType { get; set; } = 0;
|
||||||
[JsonProperty("selectedBackgroundIndex")]
|
[JsonProperty("selectedBackgroundIndex")]
|
||||||
public int SelectedBackgroundIndex { get; set; }
|
public int SelectedBackgroundIndex { get; set; }
|
||||||
[JsonProperty("customPickNameBackgrounds")]
|
[JsonProperty("customPickNameBackgrounds")]
|
||||||
|
|||||||
Reference in New Issue
Block a user