improve:对随机抽功能增加禁用开关
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Codegeex.RepoIndex": true
|
||||
}
|
||||
@@ -1965,6 +1965,15 @@
|
||||
FontWeight="Bold"
|
||||
Toggled="ToggleSwitchDisplayRandWindowNamesInputBtn_OnToggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#fafafa" Text="启用随机抽和单次抽按钮"
|
||||
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
||||
<ui:ToggleSwitch OnContent="" OffContent=""
|
||||
Name="ToggleSwitchShowRandomAndSingleDraw"
|
||||
IsOn="True" FontFamily="Microsoft YaHei UI"
|
||||
FontWeight="Bold"
|
||||
Toggled="ToggleSwitchShowRandomAndSingleDraw_Toggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
|
||||
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
@@ -4386,7 +4395,7 @@
|
||||
<Label Content="计时器" FontSize="8"
|
||||
HorizontalAlignment="Center" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel MouseDown="Border_MouseDown"
|
||||
<ui:SimpleStackPanel x:Name="RandomDrawPanel" Visibility="Collapsed" MouseDown="Border_MouseDown"
|
||||
MouseUp="SymbolIconRand_MouseUp"
|
||||
Margin="0,0,0,0" Height="38" Width="32"
|
||||
Orientation="Vertical">
|
||||
@@ -4406,7 +4415,7 @@
|
||||
<Label Content="随机抽" FontSize="8"
|
||||
HorizontalAlignment="Center" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel MouseDown="Border_MouseDown"
|
||||
<ui:SimpleStackPanel x:Name="SingleDrawPanel" Visibility="Collapsed" MouseDown="Border_MouseDown"
|
||||
MouseUp="SymbolIconRandOne_MouseUp"
|
||||
Margin="0,0,0,0" Height="38" Width="32"
|
||||
Orientation="Vertical">
|
||||
|
||||
@@ -740,9 +740,11 @@ namespace Ink_Canvas {
|
||||
}
|
||||
|
||||
private void SymbolIconRand_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
// 如果控件被隐藏,不处理事件
|
||||
if (RandomDrawPanel.Visibility != Visibility.Visible) return;
|
||||
|
||||
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
RightUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
//if (lastBorderMouseDownObject != sender) return;
|
||||
|
||||
AnimationsHelper.HideWithSlideAndFade(BorderTools);
|
||||
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
|
||||
@@ -808,14 +810,16 @@ namespace Ink_Canvas {
|
||||
}
|
||||
|
||||
private void SymbolIconRandOne_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
// 如果控件被隐藏,不处理事件
|
||||
if (SingleDrawPanel.Visibility != Visibility.Visible) return;
|
||||
|
||||
LeftUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
RightUnFoldButtonQuickPanel.Visibility = Visibility.Collapsed;
|
||||
//if (lastBorderMouseDownObject != sender) return;
|
||||
|
||||
AnimationsHelper.HideWithSlideAndFade(BorderTools);
|
||||
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
|
||||
|
||||
new RandWindow(Settings,true).ShowDialog();
|
||||
new RandWindow(Settings, true).ShowDialog();
|
||||
}
|
||||
|
||||
private void GridInkReplayButton_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
|
||||
@@ -17,6 +17,13 @@ namespace Ink_Canvas {
|
||||
private object lastBorderMouseDownObject;
|
||||
|
||||
private void Border_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
// 如果发送者是 RandomDrawPanel 或 SingleDrawPanel,且它们被隐藏,则不处理事件
|
||||
if (sender is SimpleStackPanel panel) {
|
||||
if ((panel == RandomDrawPanel || panel == SingleDrawPanel) &&
|
||||
panel.Visibility != Visibility.Visible) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
lastBorderMouseDownObject = sender;
|
||||
}
|
||||
|
||||
|
||||
@@ -1690,6 +1690,21 @@ namespace Ink_Canvas {
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchShowRandomAndSingleDraw_Toggled(object sender, RoutedEventArgs e) {
|
||||
if (!isLoaded) return;
|
||||
|
||||
// 获取开关状态并保存到设置中
|
||||
bool isToggled = ToggleSwitchShowRandomAndSingleDraw.IsOn;
|
||||
Settings.RandSettings.ShowRandomAndSingleDraw = isToggled;
|
||||
|
||||
// 更新UI显示
|
||||
RandomDrawPanel.Visibility = isToggled ? Visibility.Visible : Visibility.Collapsed;
|
||||
SingleDrawPanel.Visibility = isToggled ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
// 保存设置到文件
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static void SaveSettingsToFile() {
|
||||
|
||||
@@ -569,7 +569,14 @@ namespace Ink_Canvas {
|
||||
}
|
||||
|
||||
// RandSettings
|
||||
if (Settings.RandSettings != null) { } else {
|
||||
if (Settings.RandSettings != null) {
|
||||
ToggleSwitchDisplayRandWindowNamesInputBtn.IsOn = Settings.RandSettings.DisplayRandWindowNamesInputBtn;
|
||||
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
|
||||
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
|
||||
ToggleSwitchShowRandomAndSingleDraw.IsOn = Settings.RandSettings.ShowRandomAndSingleDraw;
|
||||
RandomDrawPanel.Visibility = Settings.RandSettings.ShowRandomAndSingleDraw ? Visibility.Visible : Visibility.Collapsed;
|
||||
SingleDrawPanel.Visibility = Settings.RandSettings.ShowRandomAndSingleDraw ? Visibility.Visible : Visibility.Collapsed;
|
||||
} else {
|
||||
Settings.RandSettings = new RandSettings();
|
||||
ToggleSwitchDisplayRandWindowNamesInputBtn.IsOn = Settings.RandSettings.DisplayRandWindowNamesInputBtn;
|
||||
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
|
||||
|
||||
@@ -406,5 +406,7 @@ namespace Ink_Canvas
|
||||
public double RandWindowOnceCloseLatency { get; set; } = 2.5;
|
||||
[JsonProperty("randWindowOnceMaxStudents")]
|
||||
public int RandWindowOnceMaxStudents { get; set; } = 10;
|
||||
[JsonProperty("showRandomAndSingleDraw")]
|
||||
public bool ShowRandomAndSingleDraw { get; set; } = true;
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
Binary file not shown.
+1367
-1332
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user