Compare commits

..

28 Commits

Author SHA1 Message Date
CJKmkp 991a823700 更新版本号 2025-10-26 00:24:28 +08:00
CJKmkp 61dbcf762c add:点名快抽 2025-10-26 00:21:10 +08:00
CJKmkp 60b0149a9c add:新点名UI 2025-10-26 00:00:13 +08:00
CJKmkp 501c034cfa fix:点名UI按钮主题显示 2025-10-25 21:14:59 +08:00
CJKmkp 11593db23c 更新版本号 2025-10-25 20:14:07 +08:00
CJKmkp a9ae2a004f improve:注释 2025-10-25 20:09:04 +08:00
CJKmkp 7b2a31781c 优化代码 2025-10-25 19:57:56 +08:00
CJKmkp ab73eb9632 优化代码 2025-10-25 19:44:32 +08:00
CJKmkp 8ade170b4e improve:计时器数字 2025-10-25 17:27:19 +08:00
CJKmkp 91c3d1161d fix:issue #210 2025-10-25 17:03:44 +08:00
CJK_mkp bb63805e87 fix:issue #210
Removed the SimulateMultiTouchToggle method and its related comments.
2025-10-23 16:27:39 +08:00
CJK_mkp 8caf04990c 更新信息 2025-10-22 17:30:38 +08:00
CJK_mkp f28dd0a965 Update AssemblyInfo.cs 2025-10-22 17:29:12 +08:00
CJK_mkp b5d83268e5 更新信息 2025-10-22 17:28:56 +08:00
CJK_mkp 19adc42122 Change PPTNavigationBtn_MouseUp to async method 2025-10-22 12:18:03 +08:00
CJK_mkp 8afee913be Update MW_PPT.cs 2025-10-22 12:16:42 +08:00
CJK_mkp 82d101365f Update MW_PPT.cs 2025-10-22 12:12:43 +08:00
CJK_mkp 73e679f268 Make PPTNavigationBtn_MouseDown async
Changed PPTNavigationBtn_MouseDown to be asynchronous and added a delay for animation.
2025-10-22 12:08:29 +08:00
CJK_mkp 372a8a1de1 fix:PPT状态浮动栏位置异常 2025-10-20 17:45:14 +08:00
CJK_mkp 171cc34c91 撤销修改 2025-10-20 12:10:47 +08:00
CJK_mkp fbd217d674 撤销修改8d778a
Removed quick color palette visibility logic from ink editing mode.
2025-10-20 10:49:04 +08:00
CJKmkp f24960ab26 improve:UIA窗口置顶 2025-10-19 01:34:03 +08:00
CJKmkp d1a871c8f6 Reapply "fix:issue # 262"
This reverts commit 086b97906b.
2025-10-18 21:20:54 +08:00
CJKmkp 086b97906b Revert "fix:issue # 262"
This reverts commit 5bfd0c7b2f.
2025-10-18 21:16:24 +08:00
CJKmkp db76a11347 improve:窗口置顶 2025-10-18 20:45:23 +08:00
CJKmkp 729b10cce8 Reapply "improve:UIA窗口置顶"
This reverts commit 4cbd25ccb3.
2025-10-18 20:41:09 +08:00
CJKmkp 4cbd25ccb3 Revert "improve:UIA窗口置顶"
This reverts commit 0ef7b738a9.
2025-10-18 20:38:08 +08:00
CJKmkp 0ef7b738a9 improve:UIA窗口置顶 2025-10-18 20:15:40 +08:00
25 changed files with 3252 additions and 105 deletions
+1 -1
View File
@@ -1 +1 @@
1.7.14.0
1.7.16.0
+2 -5
View File
@@ -38,7 +38,7 @@ namespace Ink_Canvas
// 新增:标记是否通过--show参数启动
public static bool StartWithShowMode = false;
// 新增:保存看门狗进程对象
private static Process watchdogProcess;
public static Process watchdogProcess;
// 新增:标记是否为软件内主动退出
public static bool IsAppExitByUser;
// 新增:标记是否启用了UIA置顶功能
@@ -438,7 +438,6 @@ namespace Ink_Canvas
{
_splashScreen.CloseSplashScreen();
_isSplashScreenShown = false;
LogHelper.WriteLogToFile("启动画面已关闭");
}
catch (Exception ex)
{
@@ -1034,7 +1033,7 @@ namespace Ink_Canvas
}
// 看门狗进程
private void StartWatchdogIfNeeded()
public static void StartWatchdogIfNeeded()
{
// 避免递归启动
if (Environment.GetCommandLineArgs().Contains("--watchdog")) return;
@@ -1077,8 +1076,6 @@ namespace Ink_Canvas
if (IsUIAccessTopMostEnabled)
{
string exePath = Process.GetCurrentProcess().MainModule.FileName;
Process.Start(exePath);
Environment.Exit(0);
}
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CJK_mkp")]
[assembly: AssemblyProduct("InkCanvasForClass")]
[assembly: AssemblyCopyright("Copyright © HARKOTEK Studio 2024")]
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.14.0")]
[assembly: AssemblyFileVersion("1.7.14.0")]
[assembly: AssemblyVersion("1.7.16.0")]
[assembly: AssemblyFileVersion("1.7.16.0")]
@@ -0,0 +1,35 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace Ink_Canvas.Converters
{
/// <summary>
/// 位置计算转换器
/// </summary>
public class PositionConverters
{
/// <summary>
/// 减法转换器
/// </summary>
public class SubtractConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double baseValue && parameter is string paramStr)
{
if (double.TryParse(paramStr, out double subtractValue))
{
return baseValue - subtractValue;
}
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
}
+66 -1
View File
@@ -617,7 +617,7 @@
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
Toggled="ToggleSwitchUIAccessTopMost_Toggled" />
</ui:SimpleStackPanel>
<TextBlock Name="UIAccessTopMostDescription" Text="# 开启UIA置顶后,软件自动重启置顶,关闭此功能需要完全关闭软件后再手动启动,无法使用重启来关闭此功能" TextWrapping="Wrap" Foreground="#a1a1aa" Visibility="Collapsed" />
<TextBlock Name="UIAccessTopMostDescription" Text="# 开启UIA置顶后,软件需要管理员启动才能置顶,关闭此功能需要完全关闭软件后再手动启动,无法使用重启来关闭此功能" TextWrapping="Wrap" Foreground="#a1a1aa" Visibility="Collapsed" />
<ui:ToggleSwitch OnContent="" OffContent=""
Name="ToggleSwitchIsAutoUpdate" Header="自动检查更新"
FontFamily="Microsoft YaHei UI"
@@ -3249,6 +3249,15 @@
FontWeight="Bold"
Toggled="ToggleSwitchShowRandomAndSingleDraw_Toggled" />
</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="ToggleSwitchEnableQuickDraw"
IsOn="True" FontFamily="Microsoft YaHei UI"
FontWeight="Bold"
Toggled="ToggleSwitchEnableQuickDraw_Toggled" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="直接调用外部点名"
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
@@ -3299,6 +3308,62 @@
FontFamily="Consolas"
Text="{Binding ElementName=RandWindowOnceMaxStudentsSlider, Path=Value, Converter={StaticResource IntNumberToString}}" />
</ui:SimpleStackPanel>
<!-- 新点名UI设置 -->
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
<TextBlock Foreground="#fafafa" Text="新点名UI设置"
FontSize="16" FontWeight="Bold" Margin="0,10,0,5" />
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="启用新点名UI"
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
<ui:ToggleSwitch OnContent="" OffContent=""
Name="ToggleSwitchUseNewRollCallUI"
IsOn="True" FontFamily="Microsoft YaHei UI"
FontWeight="Bold"
Toggled="ToggleSwitchUseNewRollCallUI_Toggled" />
</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="ToggleSwitchEnableMLAvoidance"
IsOn="True" FontFamily="Microsoft YaHei UI"
FontWeight="Bold"
Toggled="ToggleSwitchEnableMLAvoidance_Toggled" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="避免重复历史记录数量" VerticalAlignment="Center"
FontSize="14" Margin="0,0,16,0" />
<Slider x:Name="MLAvoidanceHistorySlider" Minimum="5"
Maximum="50" Width="168" FontFamily="Microsoft YaHei UI"
ValueChanged="MLAvoidanceHistorySlider_ValueChanged"
FontSize="20" IsSnapToTickEnabled="True" Value="20" TickFrequency="5"
TickPlacement="None" AutoToolTipPlacement="None" />
<TextBlock VerticalAlignment="Center" Margin="12,0,16,0" FontSize="14"
FontFamily="Consolas"
Text="{Binding ElementName=MLAvoidanceHistorySlider, Path=Value, Converter={StaticResource IntNumberToString}}" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="避免重复权重" VerticalAlignment="Center"
FontSize="14" Margin="0,0,16,0" />
<Slider x:Name="MLAvoidanceWeightSlider" Minimum="0.1"
Maximum="1.0" Width="168" FontFamily="Microsoft YaHei UI"
ValueChanged="MLAvoidanceWeightSlider_ValueChanged"
FontSize="20" IsSnapToTickEnabled="True" Value="0.8" TickFrequency="0.1"
TickPlacement="None" AutoToolTipPlacement="None" />
<TextBlock VerticalAlignment="Center" Margin="12,0,16,0" FontSize="14"
FontFamily="Consolas"
Text="{Binding ElementName=MLAvoidanceWeightSlider, Path=Value, StringFormat={}{0:P0}}" />
</ui:SimpleStackPanel>
<TextBlock Text="# 机器学习算法会分析最近的点名历史,智能避免重复选择相同人员"
TextWrapping="Wrap" Foreground="#a1a1aa" Margin="0,5,0,0" />
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
<TextBlock Foreground="#fafafa" Text="计时器设置"
+85 -10
View File
@@ -60,6 +60,9 @@ namespace Ink_Canvas
// 悬浮窗拦截管理器
private FloatingWindowInterceptorManager _floatingWindowInterceptorManager;
// 快抽悬浮按钮
private QuickDrawFloatingButton _quickDrawFloatingButton;
// 设置面板相关状态
private bool userChangedNoFocusModeInSettings;
private bool isTemporarilyDisablingNoFocusMode = false;
@@ -530,6 +533,9 @@ namespace Ink_Canvas
else
RadioCrashNoAction.IsChecked = true;
// 显示快抽悬浮按钮
ShowQuickDrawFloatingButton();
// 如果当前不是黑板模式,则切换到黑板模式
if (currentMode == 0)
{
@@ -668,6 +674,19 @@ namespace Ink_Canvas
private void Window_Closing(object sender, CancelEventArgs e)
{
LogHelper.WriteLogToFile("Ink Canvas closing", LogHelper.LogType.Event);
try
{
if (_quickDrawFloatingButton != null)
{
_quickDrawFloatingButton.Close();
_quickDrawFloatingButton = null;
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"关闭快抽悬浮按钮时出错: {ex.Message}", LogHelper.LogType.Error);
}
if (!CloseIsFromButton && Settings.Advanced.IsSecondConfirmWhenShutdownApp)
{
// 第一个确认对话框
@@ -1861,10 +1880,8 @@ namespace Ink_Canvas
var hwnd = new WindowInteropHelper(this).Handle;
if (Settings.Advanced.IsAlwaysOnTop)
{
// 先设置WPF的Topmost属性
Topmost = true;
// 使用更强的Win32 API调用来确保置顶
// 1. 设置窗口样式为置顶
int exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TOPMOST);
@@ -1873,8 +1890,8 @@ namespace Ink_Canvas
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
// 3. 如果启用了无焦点模式,需要特殊处理
if (Settings.Advanced.IsNoFocusMode)
// 3. 如果启用了无焦点模式且未启用UIA置顶,需要特殊处理
if (Settings.Advanced.IsNoFocusMode && !Settings.Advanced.EnableUIAccessTopMost)
{
// 启动置顶维护定时器
StartTopmostMaintenance();
@@ -1898,11 +1915,6 @@ namespace Ink_Canvas
// 3. 停止置顶维护定时器
StopTopmostMaintenance();
// 注意:这里不直接设置Topmost,让其他代码根据模式决定
// 添加调试日志
LogHelper.WriteLogToFile("应用窗口置顶: 取消置顶", LogHelper.LogType.Trace);
}
}
catch (Exception ex)
@@ -1916,6 +1928,11 @@ namespace Ink_Canvas
/// </summary>
private void StartTopmostMaintenance()
{
if (Settings.Advanced.EnableUIAccessTopMost)
{
return;
}
if (isTopmostMaintenanceEnabled) return;
if (topmostMaintenanceTimer == null)
@@ -1950,6 +1967,12 @@ namespace Ink_Canvas
{
try
{
if (Settings.Advanced.EnableUIAccessTopMost)
{
StopTopmostMaintenance();
return;
}
if (!Settings.Advanced.IsAlwaysOnTop || !Settings.Advanced.IsNoFocusMode)
{
StopTopmostMaintenance();
@@ -2505,7 +2528,9 @@ namespace Ink_Canvas
BoardHighlighterWidthSlider,
InkWidthSlider,
InkAlphaSlider,
HighlighterWidthSlider
HighlighterWidthSlider,
MLAvoidanceHistorySlider,
MLAvoidanceWeightSlider
};
foreach (var slider in sliders)
@@ -3007,6 +3032,14 @@ namespace Ink_Canvas
{
try
{
timerKillProcess.Stop();
if (App.watchdogProcess != null && !App.watchdogProcess.HasExited)
{
App.watchdogProcess.Kill();
App.watchdogProcess = null;
}
// 调用UIAccess DLL
if (Environment.Is64BitProcess)
{
@@ -3016,6 +3049,9 @@ namespace Ink_Canvas
{
PrepareUIAccessX86();
}
App.StartWatchdogIfNeeded();
timerKillProcess.Start();
}
catch (Exception ex)
{
@@ -3038,6 +3074,45 @@ namespace Ink_Canvas
}
}
/// <summary>
/// 显示快抽悬浮按钮
/// </summary>
private void ShowQuickDrawFloatingButton()
{
try
{
// 检查设置是否启用快抽功能
if (Settings?.RandSettings?.EnableQuickDraw != true)
{
// 如果设置未启用,确保悬浮按钮被关闭
if (_quickDrawFloatingButton != null)
{
_quickDrawFloatingButton.Close();
_quickDrawFloatingButton = null;
}
return;
}
// 如果已经存在悬浮按钮,先关闭它
if (_quickDrawFloatingButton != null)
{
_quickDrawFloatingButton.Close();
_quickDrawFloatingButton = null;
}
// 创建并显示悬浮按钮
_quickDrawFloatingButton = new QuickDrawFloatingButton();
_quickDrawFloatingButton.Show();
LogHelper.WriteLogToFile("快抽悬浮按钮已显示", LogHelper.LogType.Trace);
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"显示快抽悬浮按钮失败: {ex.Message}", LogHelper.LogType.Error);
}
}
#endregion
}
}
+58 -28
View File
@@ -1085,11 +1085,20 @@ namespace Ink_Canvas
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
AnimationsHelper.HideWithSlideAndFade(BoardImageOptionsPanel);
var randWindow = new RandWindow(Settings);
randWindow.Show();
// 根据设置决定使用哪个点名窗口
if (Settings.RandSettings.UseNewRollCallUI)
{
// 使用新点名UI - 随机抽模式
new NewStyleRollCallWindow(Settings, false).ShowDialog();
}
else
{
// 使用默认的随机点名窗口
var randWindow = new RandWindow(Settings);
randWindow.Show();
// 使用延迟确保窗口完全显示后再强制置顶
randWindow.Dispatcher.BeginInvoke(new Action(() =>
// 使用延迟确保窗口完全显示后再强制置顶
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();
}
}
}
@@ -2844,36 +2870,32 @@ namespace Ink_Canvas
if (Settings.Canvas.ClearCanvasAndClearTimeMachine) timeMachine.ClearStrokeHistory();
// 清空墨迹后模拟用户重新手动开关多指书写功能
SimulateMultiTouchToggle();
if (Settings.Gesture.IsEnableMultiTouchMode && ToggleSwitchEnableMultiTouchMode != null && ToggleSwitchEnableMultiTouchMode.IsOn)
{
ReinitializeMultiTouchMode();
}
}
private bool lastIsInMultiTouchMode;
/// <summary>
/// 模拟用户重新手动开关多指书写功能
/// </summary>
private void SimulateMultiTouchToggle()
private void ReinitializeMultiTouchMode()
{
try
{
// 检查多指书写模式是否启用
if (ToggleSwitchEnableMultiTouchMode != null && ToggleSwitchEnableMultiTouchMode.IsOn)
if (!isInMultiTouchMode)
{
// 先关闭多指书写模式
ToggleSwitchEnableMultiTouchMode.IsOn = false;
// 使用Dispatcher.BeginInvoke确保UI更新完成后再重新开启
Dispatcher.BeginInvoke(new Action(() =>
{
// 重新开启多指书写模式
ToggleSwitchEnableMultiTouchMode.IsOn = true;
}), DispatcherPriority.Background);
isInMultiTouchMode = true;
}
inkCanvas.TouchDown -= Main_Grid_TouchDown;
inkCanvas.TouchDown += MainWindow_TouchDown;
inkCanvas.StylusDown += MainWindow_StylusDown;
inkCanvas.StylusMove += MainWindow_StylusMove;
inkCanvas.StylusUp += MainWindow_StylusUp;
}
catch (Exception ex)
catch (Exception)
{
LogHelper.WriteLogToFile($"模拟多指书写开关时发生错误: {ex.Message}", LogHelper.LogType.Error);
}
}
@@ -3104,7 +3126,15 @@ namespace Ink_Canvas
}
StackPanelPPTButtons.Visibility = Visibility.Collapsed;
Topmost = false;
if (Settings.Advanced.EnableUIAccessTopMost)
{
Topmost = true;
}
else
{
Topmost = false;
}
break;
}
}
+13 -5
View File
@@ -643,7 +643,7 @@ namespace Ink_Canvas
}
}
private void OnPPTSlideShowBegin(SlideShowWindow wn)
private async void OnPPTSlideShowBegin(SlideShowWindow wn)
{
try
{
@@ -659,13 +659,13 @@ namespace Ink_Canvas
{
if (isFloatingBarFolded)
{
UnFoldFloatingBar(new object());
await UnFoldFloatingBar(new object());
}
}
isStopInkReplay = true;
Application.Current.Dispatcher.Invoke(() =>
await Application.Current.Dispatcher.InvokeAsync(() =>
{
var activePresentation = _pptManager?.GetCurrentActivePresentation();
if (activePresentation != null)
@@ -785,7 +785,14 @@ namespace Ink_Canvas
if (!isFloatingBarFolded)
{
ViewboxFloatingBarMarginAnimation(60);
new Thread(() =>
{
Thread.Sleep(100);
Application.Current.Dispatcher.Invoke(() =>
{
ViewboxFloatingBarMarginAnimation(60);
});
}).Start();
}
}
catch (Exception ex)
@@ -1584,7 +1591,7 @@ namespace Ink_Canvas
}
}
private void PPTNavigationBtn_MouseUp(object sender, MouseButtonEventArgs e)
private async void PPTNavigationBtn_MouseUp(object sender, MouseButtonEventArgs e)
{
if (lastBorderMouseDownObject != sender) return;
@@ -1633,6 +1640,7 @@ namespace Ink_Canvas
// 控制居中
if (!isFloatingBarFolded)
{
await Task.Delay(100);
ViewboxFloatingBarMarginAnimation(60);
}
}
+43
View File
@@ -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<double> e)
{
if (!isLoaded) return;
Settings.RandSettings.MLAvoidanceHistoryCount = (int)MLAvoidanceHistorySlider.Value;
SaveSettingsToFile();
}
private void MLAvoidanceWeightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!isLoaded) return;
Settings.RandSettings.MLAvoidanceWeight = MLAvoidanceWeightSlider.Value;
SaveSettingsToFile();
}
private void ProgressiveReminderVolumeSlider_ValueChanged(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
@@ -2740,6 +2769,20 @@ namespace Ink_Canvas
SaveSettingsToFile();
}
private void ToggleSwitchEnableQuickDraw_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
// 获取开关状态并保存到设置中
Settings.RandSettings.EnableQuickDraw = ToggleSwitchEnableQuickDraw.IsOn;
// 保存设置到文件
SaveSettingsToFile();
// 根据设置状态显示或隐藏快抽悬浮按钮
ShowQuickDrawFloatingButton();
}
private void ToggleSwitchExternalCaller_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
@@ -876,6 +876,7 @@ namespace Ink_Canvas
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
ToggleSwitchShowRandomAndSingleDraw.IsOn = Settings.RandSettings.ShowRandomAndSingleDraw;
ToggleSwitchEnableQuickDraw.IsOn = Settings.RandSettings.EnableQuickDraw;
ToggleSwitchExternalCaller.IsOn = Settings.RandSettings.DirectCallCiRand;
ComboBoxExternalCallerType.SelectedIndex = Settings.RandSettings.ExternalCallerType;
RandomDrawPanel.Visibility = Settings.RandSettings.ShowRandomAndSingleDraw ? Visibility.Visible : Visibility.Collapsed;
@@ -886,6 +887,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)
@@ -915,6 +922,7 @@ namespace Ink_Canvas
ToggleSwitchDisplayRandWindowNamesInputBtn.IsOn = Settings.RandSettings.DisplayRandWindowNamesInputBtn;
RandWindowOnceCloseLatencySlider.Value = Settings.RandSettings.RandWindowOnceCloseLatency;
RandWindowOnceMaxStudentsSlider.Value = Settings.RandSettings.RandWindowOnceMaxStudents;
ToggleSwitchEnableQuickDraw.IsOn = Settings.RandSettings.EnableQuickDraw;
ToggleSwitchExternalCaller.IsOn = Settings.RandSettings.DirectCallCiRand;
ComboBoxExternalCallerType.SelectedIndex = Settings.RandSettings.ExternalCallerType;
ToggleSwitchUseLegacyTimerUI.IsOn = Settings.RandSettings.UseLegacyTimerUI;
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("CJK_mkp")]
[assembly: AssemblyProduct("InkCanvasForClass")]
[assembly: AssemblyCopyright("Copyright © HARKOTEK Studio 2024")]
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.14.0")]
[assembly: AssemblyFileVersion("1.7.14.0")]
[assembly: AssemblyVersion("1.7.16.0")]
[assembly: AssemblyFileVersion("1.7.16.0")]
@@ -0,0 +1,39 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 新点名窗口主题资源 -->
<!-- 浅色主题资源 -->
<SolidColorBrush x:Key="NewRollCallWindowBackgroundLight" Color="#FFFFFF"/>
<SolidColorBrush x:Key="NewRollCallWindowBorderBrushLight" Color="#E4E4E7"/>
<SolidColorBrush x:Key="NewRollCallWindowTitleForegroundLight" Color="#18181B"/>
<SolidColorBrush x:Key="NewRollCallWindowDigitForegroundLight" Color="#18181B"/>
<SolidColorBrush x:Key="NewRollCallWindowButtonBackgroundLight" Color="#F4F4F5"/>
<SolidColorBrush x:Key="NewRollCallWindowButtonForegroundLight" Color="#18181B"/>
<SolidColorBrush x:Key="NewRollCallWindowPrimaryButtonBackgroundLight" Color="#4CAF50"/>
<SolidColorBrush x:Key="NewRollCallWindowPrimaryButtonForegroundLight" Color="#FFFFFF"/>
<SolidColorBrush x:Key="NewRollCallWindowSecondaryTextForegroundLight" Color="#71717A"/>
<!-- 深色主题资源 -->
<SolidColorBrush x:Key="NewRollCallWindowBackgroundDark" Color="#1f1f1f"/>
<SolidColorBrush x:Key="NewRollCallWindowBorderBrushDark" Color="#E0E0E0"/>
<SolidColorBrush x:Key="NewRollCallWindowTitleForegroundDark" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowDigitForegroundDark" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowButtonBackgroundDark" Color="#2a2a2a"/>
<SolidColorBrush x:Key="NewRollCallWindowButtonForegroundDark" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowPrimaryButtonBackgroundDark" Color="#4CAF50"/>
<SolidColorBrush x:Key="NewRollCallWindowPrimaryButtonForegroundDark" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowSecondaryTextForegroundDark" Color="#9ca3af"/>
<!-- 默认资源绑定 -->
<SolidColorBrush x:Key="NewRollCallWindowBackground" Color="#1f1f1f"/>
<SolidColorBrush x:Key="NewRollCallWindowBorderBrush" Color="#E0E0E0"/>
<SolidColorBrush x:Key="NewRollCallWindowTitleForeground" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowDigitForeground" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowButtonBackground" Color="#2a2a2a"/>
<SolidColorBrush x:Key="NewRollCallWindowButtonForeground" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowPrimaryButtonBackground" Color="#4CAF50"/>
<SolidColorBrush x:Key="NewRollCallWindowPrimaryButtonForeground" Color="White"/>
<SolidColorBrush x:Key="NewRollCallWindowSecondaryTextForeground" Color="#9ca3af"/>
</ResourceDictionary>
+10
View File
@@ -650,6 +650,16 @@ 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;
[JsonProperty("enableQuickDraw")]
public bool EnableQuickDraw { get; set; } = true;
}
public class CustomPickNameBackground
+2 -2
View File
@@ -88,8 +88,8 @@
<SolidColorBrush x:Key="RandWindowBackground" Color="#1f1f1f"/>
<SolidColorBrush x:Key="RandWindowBorderBrush" Color="#0066BF"/>
<SolidColorBrush x:Key="RandWindowTextForeground" Color="White"/>
<SolidColorBrush x:Key="RandWindowButtonBackground" Color="#FBFBFD"/>
<SolidColorBrush x:Key="RandWindowButtonForeground" Color="Black"/>
<SolidColorBrush x:Key="RandWindowButtonBackground" Color="#3F3F46"/>
<SolidColorBrush x:Key="RandWindowButtonForeground" Color="White"/>
<SolidColorBrush x:Key="RandWindowPrimaryButtonBackground" Color="#0066BF"/>
<SolidColorBrush x:Key="RandWindowPrimaryButtonForeground" Color="White"/>
<SolidColorBrush x:Key="RandWindowSecondaryButtonBackground" Color="#00B894"/>
+10 -10
View File
@@ -2,24 +2,24 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 数字0-9的SVG路径数据 -->
<Geometry x:Key="Digit0">M2.432,34.536 C2.432,30.6533333 2.83733333,27.2506667 3.648,24.328 C4.45866667,21.4053333 5.6,18.984 7.072,17.064 C8.544,15.144 10.304,13.704 12.352,12.744 C14.4,11.784 16.6826667,11.304 19.2,11.304 C24.576,11.304 28.7146667,13.192 31.616,16.968 C34.5173333,20.744 35.968,26.6 35.968,34.536 C35.968,38.4613333 35.5626667,41.8853333 34.752,44.808 C33.9413333,47.7306667 32.8,50.1626667 31.328,52.104 C29.856,54.0453333 28.0853333,55.496 26.016,56.456 C23.9466667,57.416 21.6533333,57.896 19.136,57.896 C13.7173333,57.896 9.57866667,55.9013333 6.72,51.912 C3.86133333,47.9226667 2.432,42.1306667 2.432,34.536 Z M27.776,34.536 C27.776,33.8533333 27.7653333,33.2026667 27.744,32.584 C27.7226667,31.9653333 27.6906667,31.3573333 27.648,30.76 L11.968,45.032 C13.2906667,48.9146667 15.7013333,50.856 19.2,50.856 C21.9306667,50.856 24.0426667,49.5546667 25.536,46.952 C27.0293333,44.3493333 27.776,40.2106667 27.776,34.536 Z M10.624,34.536 C10.624,35.176 10.6346667,35.784 10.656,36.36 C10.6773333,36.936 10.7093333,37.5226667 10.752,38.12 L26.368,23.848 C25.088,20.1786667 22.6773333,18.344 19.136,18.344 C16.4053333,18.344 14.304,19.656 12.832,22.28 C11.36,24.904 10.624,28.9893333 10.624,34.536 Z</Geometry>
<Geometry x:Key="Digit0">M840.61 501.32 q0 244.71 -91.93 371.69 q-91.93 126.99 -249.34 126.99 q-101.85 0 -178.57 -56.21 q-76.72 -56.22 -119.05 -167.99 q-42.33 -111.78 -42.33 -274.48 q0 -164.02 42.33 -276.45 q42.33 -112.44 119.05 -168.65 q76.72 -56.22 178.57 -56.22 q157.41 0 249.34 127.64 q91.93 127.64 91.93 373.68 ZM310.19 501.32 q0 182.54 50.26 275.8 q50.26 93.25 138.89 93.25 q88.62 0 139.55 -92.59 q50.92 -92.59 50.92 -276.46 q0 -183.86 -50.92 -277.77 q-50.92 -93.91 -139.55 -93.91 q-88.63 0 -138.89 93.25 q-50.26 93.25 -50.26 278.44 Z</Geometry>
<Geometry x:Key="Digit1">M46.184 49.96 L55.976 49.96 L55.976 21.992 L47.528 28.456 L43.688 23.336 L58.28 12.2 L63.912 12.2 L63.912 49.96 L73.512 49.96 L73.512 57 L46.184 57 Z</Geometry>
<Geometry x:Key="Digit1">M309 301.5 l0 -145.97 l268.76 -155.53 l113.24 0 l0 1000 l-148.71 0 l0 -830.83 l-233.29 132.33 Z</Geometry>
<Geometry x:Key="Digit2">M112.272,57 L83.728,57 L83.728,50.792 C84.24,50.3653333 84.88,49.8 85.648,49.096 C86.416,48.392 87.28,47.592 88.24,46.696 C89.2,45.8 90.2133333,44.8186667 91.28,43.752 C92.3466667,42.6853333 93.392,41.576 94.416,40.424 C95.8666667,38.8026667 97.136,37.3306667 98.224,36.008 C99.312,34.6853333 100.208,33.4373333 100.912,32.264 C101.616,31.0906667 102.138667,29.9386667 102.48,28.808 C102.821333,27.6773333 102.992,26.5146667 102.992,25.32 C102.992,24.4666667 102.8,23.6346667 102.416,22.824 C102.032,22.0133333 101.498667,21.2986667 100.816,20.68 C100.133333,20.0613333 99.312,19.5706667 98.352,19.208 C97.392,18.8453333 96.336,18.664 95.184,18.664 C93.648,18.664 92.2506667,18.8986667 90.992,19.368 C89.7333333,19.8373333 88.4213333,20.6266667 87.056,21.736 L83.728,15.848 C85.52,14.568 87.5146667,13.4906667 89.712,12.616 C91.9093333,11.7413333 94.4373333,11.304 97.296,11.304 C99.1306667,11.304 100.890667,11.56 102.576,12.072 C104.261333,12.584 105.754667,13.3413333 107.056,14.344 C108.357333,15.3466667 109.392,16.5946667 110.16,18.088 C110.928,19.5813333 111.312,21.3093333 111.312,23.272 C111.312,24.6373333 111.194667,25.9066667 110.96,27.08 C110.725333,28.2533333 110.362667,29.4266667 109.872,30.6 C109.381333,31.7733333 108.741333,32.9786667 107.952,34.216 C107.162667,35.4533333 106.213333,36.7973333 105.104,38.248 C104.250667,39.3573333 103.322667,40.4773333 102.32,41.608 C101.317333,42.7386667 100.325333,43.816 99.344,44.84 C98.3626667,45.864 97.392,46.824 96.432,47.72 C95.472,48.616 94.608,49.3626667 93.84,49.96 L112.272,49.96 L112.272,57 Z</Geometry>
<Geometry x:Key="Digit2">M393.43 872.65 l427.62 0 l0 127.35 l-642.1 0 l0 -92.49 l309.66 -348.53 q84.45 -92.49 117.29 -146.78 q32.84 -54.29 32.84 -118.63 q0 -76.41 -42.23 -119.31 q-42.23 -42.89 -106.56 -42.89 q-67.03 0 -118.63 45.57 q-51.61 45.58 -74.39 124.67 l-115.28 -65.69 q30.83 -112.6 119.97 -174.26 q89.14 -61.66 199.06 -61.66 q83.11 0 149.46 34.85 q66.36 34.85 103.88 99.87 q37.53 65.01 37.53 152.14 q0 87.13 -42.22 163.54 q-42.23 76.41 -149.46 193.03 l-206.44 229.22 Z</Geometry>
<Geometry x:Key="Digit3">M134.072,50.856 C135.48,50.856 136.770667,50.6746667 137.944,50.312 C139.117333,49.9493333 140.12,49.4373333 140.952,48.776 C141.784,48.1146667 142.434667,47.3466667 142.904,46.472 C143.373333,45.5973333 143.608,44.648 143.608,43.624 C143.608,42.344 143.341333,41.2666667 142.808,40.392 C142.274667,39.5173333 141.538667,38.824 140.6,38.312 C139.661333,37.8 138.530667,37.4373333 137.208,37.224 C135.885333,37.0106667 134.456,36.904 132.92,36.904 L129.336,36.904 L129.336,32.36 L140.088,19.24 L123.896,19.24 L123.896,12.2 L150.008,12.2 L150.008,18.024 L138.744,30.888 L140.216,30.888 C141.709333,30.888 143.16,31.144 144.568,31.656 C145.976,32.168 147.224,32.936 148.312,33.96 C149.4,34.984 150.274667,36.264 150.936,37.8 C151.597333,39.336 151.928,41.1066667 151.928,43.112 C151.928,45.544 151.426667,47.6773333 150.424,49.512 C149.421333,51.3466667 148.098667,52.8933333 146.456,54.152 C144.813333,55.4106667 142.925333,56.3493333 140.792,56.968 C138.658667,57.5866667 136.461333,57.896 134.2,57.896 C132.28,57.896 130.36,57.7253333 128.44,57.384 C126.52,57.0426667 124.664,56.5093333 122.872,55.784 L125.112,48.872 C125.496,49.0853333 126.018667,49.2986667 126.68,49.512 C127.341333,49.7253333 128.088,49.9386667 128.92,50.152 C129.752,50.3653333 130.605333,50.536 131.48,50.664 C132.354667,50.792 133.218667,50.856 134.072,50.856 Z</Geometry>
<Geometry x:Key="Digit3">M649.27 472.92 q84.55 27.74 127.48 89.17 q42.93 61.42 42.93 151.25 q0 89.83 -43.59 154.56 q-43.59 64.73 -116.24 98.42 q-72.65 33.68 -158.53 33.68 q-110.96 0 -200.13 -54.82 q-89.17 -54.82 -120.87 -160.5 l113.6 -64.73 q23.78 75.29 80.58 114.26 q56.81 38.97 125.5 38.97 q71.33 0 120.21 -44.25 q48.88 -44.25 48.88 -120.87 q0 -163.81 -229.86 -163.81 l-39.63 0 l1.32 -122.85 l47.56 0 q91.15 0 138.7 -44.25 q47.56 -44.25 47.56 -111.63 q0 -63.41 -40.29 -100.39 q-40.29 -36.99 -103.7 -36.99 q-66.05 0 -113.61 40.95 q-47.56 40.95 -72.65 116.25 l-110.96 -64.73 q31.7 -108.32 114.27 -164.47 q82.56 -56.15 192.2 -56.15 q84.54 0 149.27 32.37 q64.73 32.37 100.4 91.15 q35.67 58.78 35.67 135.41 q0 72.65 -33.69 128.8 q-33.68 56.14 -102.38 85.2 Z</Geometry>
<Geometry x:Key="Digit4">M194.528,44.52 L186.848,44.52 L186.848,57 L179.104,57 L179.104,44.52 L159.712,44.52 L159.712,38.824 L180,11.88 L186.848,11.88 L186.848,37.864 L194.528,37.864 L194.528,44.52 Z M179.104,23.656 L167.968,37.864 L179.104,37.864 L179.104,23.656 Z</Geometry>
<Geometry x:Key="Digit4">M723.06 394.27 l0 264.67 l147.34 0 l0 125.51 l-147.34 0 l0 215.55 l-144.62 0 l0 -215.55 l-448.84 0 l0 -100.96 l376.54 -683.49 l156.89 0 l-364.26 658.94 l279.67 0 l0 -264.67 l144.62 0 Z</Geometry>
<Geometry x:Key="Digit5">M212.168,50.536 C213.576,50.536 214.877333,50.3653333 216.072,50.024 C217.266667,49.6826667 218.301333,49.192 219.176,48.552 C220.050667,47.912 220.733333,47.1226667 221.224,46.184 C221.714667,45.2453333 221.96,44.1786667 221.96,42.984 C221.96,40.6373333 221.032,38.792 219.176,37.448 C217.32,36.104 214.536,35.432 210.824,35.432 C210.354667,35.432 209.810667,35.4426667 209.192,35.464 C208.573333,35.4853333 207.986667,35.5173333 207.432,35.56 C206.792,35.6026667 206.130667,35.624 205.448,35.624 L205.448,12.2 L228.616,12.2 L228.616,19.88 L212.616,19.88 L212.616,28.648 C212.957333,28.648 213.298667,28.6266667 213.64,28.584 C213.938667,28.584 214.226667,28.5733333 214.504,28.552 C214.781333,28.5306667 215.026667,28.52 215.24,28.52 C217.373333,28.52 219.357333,28.8293333 221.192,29.448 C223.026667,30.0666667 224.626667,30.9946667 225.992,32.232 C227.357333,33.4693333 228.413333,34.9733333 229.16,36.744 C229.906667,38.5146667 230.28,40.4666667 230.28,42.6 C230.28,45.1173333 229.810667,47.3253333 228.872,49.224 C227.933333,51.1226667 226.653333,52.712 225.032,53.992 C223.410667,55.272 221.533333,56.2426667 219.4,56.904 C217.266667,57.5653333 214.984,57.896 212.552,57.896 C211.613333,57.896 210.610667,57.8 209.544,57.608 C208.477333,57.416 207.432,57.1813333 206.408,56.904 C205.384,56.6266667 204.434667,56.3173333 203.56,55.976 C202.685333,55.6346667 201.949333,55.3146667 201.352,55.016 L204.04,48.36 C204.765333,48.7866667 205.885333,49.256 207.4,49.768 C208.914667,50.28 210.504,50.536 212.168,50.536 Z</Geometry>
<Geometry x:Key="Digit5">M503.36 355.7 q87.24 0 157.04 39.6 q69.8 39.6 110.07 111.41 q40.27 71.81 40.27 165.77 q0 97.99 -43.63 172.49 q-43.63 74.5 -118.12 114.76 q-74.5 40.27 -161.75 40.27 q-102.02 0 -183.23 -50.34 q-81.2 -50.33 -114.76 -145.63 l115.44 -67.12 q25.5 65.77 72.48 100 q46.98 34.23 108.73 34.23 q79.19 0 125.5 -53.02 q46.31 -53.02 46.31 -140.27 q0 -84.56 -44.97 -139.6 q-44.97 -55.03 -128.19 -55.03 q-60.4 0 -106.04 28.19 q-45.63 28.19 -72.48 75.17 l-96.64 -48.32 l65.77 -538.26 l491.27 0 l0 124.83 l-366.44 0 l-34.9 264.43 q63.09 -33.56 138.26 -33.56 Z</Geometry>
<Geometry x:Key="Digit6">M271.344,43.112 C271.344,45.2026667 270.949333,47.144 270.16,48.936 C269.370667,50.728 268.293333,52.2853333 266.928,53.608 C265.562667,54.9306667 263.930667,55.976 262.032,56.744 C260.133333,57.512 258.096,57.896 255.92,57.896 C253.701333,57.896 251.621333,57.544 249.68,56.84 C247.738667,56.136 246.042667,55.08 244.592,53.672 C243.141333,52.264 241.989333,50.4933333 241.136,48.36 C240.282667,46.2266667 239.856,43.752 239.856,40.936 C239.856,36.712 240.592,32.872 242.064,29.416 C243.536,25.96 245.424,22.9626667 247.728,20.424 C250.032,17.8853333 252.613333,15.8373333 255.472,14.28 C258.330667,12.7226667 261.168,11.7306667 263.984,11.304 L265.84,17.896 C263.578667,18.3226667 261.466667,19.016 259.504,19.976 C257.541333,20.936 255.792,22.0986667 254.256,23.464 C252.72,24.8293333 251.429333,26.344 250.384,28.008 C249.338667,29.672 248.624,31.4 248.24,33.192 C249.093333,32.1253333 250.373333,31.2186667 252.08,30.472 C253.786667,29.7253333 255.664,29.352 257.712,29.352 C259.632,29.352 261.424,29.6613333 263.088,30.28 C264.752,30.8986667 266.192,31.7946667 267.408,32.968 C268.624,34.1413333 269.584,35.5813333 270.288,37.288 C270.992,38.9946667 271.344,40.936 271.344,43.112 Z M263.28,43.432 C263.28,41.128 262.586667,39.3786667 261.2,38.184 C259.813333,36.9893333 257.946667,36.392 255.6,36.392 C253.893333,36.392 252.357333,36.776 250.992,37.544 C249.626667,38.312 248.624,39.208 247.984,40.232 C247.898667,40.7013333 247.845333,41.224 247.824,41.8 C247.802667,42.376 247.792,42.8346667 247.792,43.176 C247.792,44.2 247.962667,45.1813333 248.304,46.12 C248.645333,47.0586667 249.146667,47.88 249.808,48.584 C250.469333,49.288 251.269333,49.8426667 252.208,50.248 C253.146667,50.6533333 254.234667,50.856 255.472,50.856 C256.453333,50.856 257.413333,50.6746667 258.352,50.312 C259.290667,49.9493333 260.122667,49.448 260.848,48.808 C261.573333,48.168 262.16,47.3893333 262.608,46.472 C263.056,45.5546667 263.28,44.5413333 263.28,43.432 Z</Geometry>
<Geometry x:Key="Digit6">M521.48 367.79 q91.27 0 161.74 40.94 q70.47 40.94 109.39 112.08 q38.92 71.14 38.92 159.73 q0 91.27 -42.95 163.75 q-42.95 72.49 -118.79 114.1 q-75.84 41.61 -169.8 41.61 q-95.3 0 -171.14 -40.94 q-75.84 -40.94 -118.12 -113.42 q-42.28 -72.49 -42.28 -166.44 q0 -76.51 28.85 -144.3 q28.85 -67.78 89.26 -163.08 l230.87 -371.81 l159.73 0 l-198.66 315.44 l-44.29 64.43 q41.61 -12.08 87.25 -12.08 ZM498.66 869.8 q81.88 0 130.2 -51.68 q48.32 -51.68 48.32 -133.56 q0 -84.56 -47.65 -136.91 q-47.65 -52.35 -130.87 -52.35 q-81.88 0 -130.21 53.02 q-48.32 53.02 -48.32 136.24 q0 83.23 49 134.24 q49 51 129.54 51 Z</Geometry>
<Geometry x:Key="Digit7">M282.328 57 L300.76 19.752 L279.896 19.752 L279.896 12.2 L309.08 12.2 L309.08 18.472 L290.456 57 Z</Geometry>
<Geometry x:Key="Digit7">M653.27 126.7 l-471.39 0 l0 -126.7 l636.24 0 l0 91.28 l-363.76 908.72 l-160.76 0 l359.67 -873.3 Z</Geometry>
<Geometry x:Key="Digit8">M319.04,46.056 C319.04,44.5626667 319.285333,43.1973333 319.776,41.96 C320.266667,40.7226667 320.906667,39.6133333 321.696,38.632 C322.485333,37.6506667 323.392,36.7653333 324.416,35.976 C325.44,35.1866667 326.485333,34.4933333 327.552,33.896 C325.418667,32.6586667 323.648,31.1973333 322.24,29.512 C320.832,27.8266667 320.128,25.704 320.128,23.144 C320.128,21.48 320.490667,19.9226667 321.216,18.472 C321.941333,17.0213333 322.954667,15.7626667 324.256,14.696 C325.557333,13.6293333 327.104,12.7973333 328.896,12.2 C330.688,11.6026667 332.629333,11.304 334.72,11.304 C336.64,11.304 338.442667,11.56 340.128,12.072 C341.813333,12.584 343.296,13.3093333 344.576,14.248 C345.856,15.1866667 346.858667,16.328 347.584,17.672 C348.309333,19.016 348.672,20.4986667 348.672,22.12 C348.672,24.6373333 348.021333,26.8346667 346.72,28.712 C345.418667,30.5893333 343.637333,32.2106667 341.376,33.576 C343.936,34.8986667 345.973333,36.456 347.488,38.248 C349.002667,40.04 349.76,42.344 349.76,45.16 C349.76,47.08 349.344,48.8186667 348.512,50.376 C347.68,51.9333333 346.56,53.2666667 345.152,54.376 C343.744,55.4853333 342.090667,56.3493333 340.192,56.968 C338.293333,57.5866667 336.277333,57.896 334.144,57.896 C332.010667,57.896 330.026667,57.608 328.192,57.032 C326.357333,56.456 324.757333,55.656 323.392,54.632 C322.026667,53.608 320.96,52.3706667 320.192,50.92 C319.424,49.4693333 319.04,47.848 319.04,46.056 Z M341.824,44.968 C341.824,43.9013333 341.546667,42.984 340.992,42.216 C340.437333,41.448 339.744,40.7653333 338.912,40.168 C338.08,39.5706667 337.162667,39.0266667 336.16,38.536 C335.157333,38.0453333 334.186667,37.544 333.248,37.032 C331.114667,37.9706667 329.472,39.176 328.32,40.648 C327.168,42.12 326.592,43.5173333 326.592,44.84 C326.592,46.76 327.274667,48.2426667 328.64,49.288 C330.005333,50.3333333 331.904,50.856 334.336,50.856 C336.512,50.856 338.304,50.3546667 339.712,49.352 C341.12,48.3493333 341.824,46.888 341.824,44.968 Z M328.064,23.528 C328.064,24.552 328.288,25.416 328.736,26.12 C329.184,26.824 329.76,27.4426667 330.464,27.976 C331.168,28.5093333 331.968,28.9893333 332.864,29.416 C333.76,29.8426667 334.656,30.2693333 335.552,30.696 C336.234667,30.3546667 336.906667,29.928 337.568,29.416 C338.229333,28.904 338.816,28.3386667 339.328,27.72 C339.84,27.1013333 340.256,26.4613333 340.576,25.8 C340.896,25.1386667 341.056,24.4666667 341.056,23.784 C341.056,22.888 340.864,22.1093333 340.48,21.448 C340.096,20.7866667 339.594667,20.2213333 338.976,19.752 C338.357333,19.2826667 337.664,18.9306667 336.896,18.696 C336.128,18.4613333 335.338667,18.344 334.528,18.344 C333.589333,18.344 332.725333,18.4933333 331.936,18.792 C331.146667,19.0906667 330.464,19.4746667 329.888,19.944 C329.312,20.4133333 328.864,20.968 328.544,21.608 C328.224,22.248 328.064,22.888 328.064,23.528 Z</Geometry>
<Geometry x:Key="Digit8">M663.8 459.71 q77.94 34.35 122.2 99.07 q44.25 64.73 44.25 151.92 q0 83.22 -41.61 149.27 q-41.61 66.05 -116.25 103.04 q-74.64 36.99 -169.75 36.99 q-97.75 0 -173.05 -36.99 q-75.3 -36.99 -117.57 -103.04 q-42.27 -66.05 -42.27 -149.27 q0 -85.87 44.91 -151.25 q44.91 -65.39 121.53 -99.74 q-62.09 -30.38 -97.76 -83.22 q-35.67 -52.84 -35.67 -120.22 q0 -70.01 38.31 -128.79 q38.31 -58.78 106.34 -93.13 q68.04 -34.34 155.22 -34.34 q87.19 0 153.24 34.34 q66.05 34.34 101.72 92.47 q35.66 58.13 35.66 129.45 q0 67.38 -34.35 120.22 q-34.34 52.84 -95.12 83.22 ZM502.64 122.85 q-68.69 0 -110.3 38.97 q-41.61 38.97 -41.61 99.74 q0 60.76 41.61 99.73 q41.61 38.97 110.3 38.97 q67.37 0 108.99 -38.97 q41.62 -38.97 41.62 -99.73 q0 -60.77 -41.62 -99.74 q-41.62 -38.97 -108.99 -38.97 ZM502.64 873.18 q79.26 0 128.8 -45.57 q49.54 -45.58 49.54 -124.84 q0 -80.58 -48.88 -128.79 q-48.88 -48.22 -129.46 -48.22 q-83.22 0 -132.1 48.22 q-48.88 48.22 -48.88 128.79 q0 79.26 49.54 124.84 q49.54 45.57 131.44 45.57 Z</Geometry>
<Geometry x:Key="Digit9">M358.056,26.216 C358.056,24.04 358.429333,22.0346667 359.176,20.2 C359.922667,18.3653333 360.968,16.7973333 362.312,15.496 C363.656,14.1946667 365.277333,13.1706667 367.176,12.424 C369.074667,11.6773333 371.197333,11.304 373.544,11.304 C375.933333,11.304 378.109333,11.6666667 380.072,12.392 C382.034667,13.1173333 383.72,14.1946667 385.128,15.624 C386.536,17.0533333 387.624,18.824 388.392,20.936 C389.16,23.048 389.544,25.4693333 389.544,28.2 C389.544,33.1493333 388.904,37.416 387.624,41 C386.344,44.584 384.626667,47.5706667 382.472,49.96 C380.317333,52.3493333 377.810667,54.184 374.952,55.464 C372.093333,56.744 369.106667,57.5546667 365.992,57.896 L364.2,51.368 C366.546667,51.0693333 368.669333,50.4933333 370.568,49.64 C372.466667,48.7866667 374.12,47.7306667 375.528,46.472 C376.936,45.2133333 378.088,43.784 378.984,42.184 C379.88,40.584 380.456,38.8666667 380.712,37.032 C379.816,37.928 378.664,38.6426667 377.256,39.176 C375.848,39.7093333 374.162667,39.976 372.2,39.976 L372.072,39.976 C370.450667,39.976 368.808,39.6986667 367.144,39.144 C365.48,38.5893333 363.976,37.736 362.632,36.584 C361.288,35.432 360.189333,33.992 359.336,32.264 C358.482667,30.536 358.056,28.52 358.056,26.216 Z M366.12,25.768 C366.12,26.9626667 366.344,28.0186667 366.792,28.936 C367.24,29.8533333 367.826667,30.6213333 368.552,31.24 C369.277333,31.8586667 370.12,32.328 371.08,32.648 C372.04,32.968 373.032,33.128 374.056,33.128 C375.805333,33.128 377.32,32.8506667 378.6,32.296 C379.88,31.7413333 380.818667,31.0586667 381.416,30.248 C381.544,29.352 381.608,28.4986667 381.608,27.688 C381.608,26.4933333 381.437333,25.32 381.096,24.168 C380.754667,23.016 380.242667,21.992 379.56,21.096 C378.877333,20.2 378.024,19.4853333 377,18.952 C375.976,18.4186667 374.802667,18.152 373.48,18.152 C371.389333,18.152 369.64,18.824 368.232,20.168 C366.824,21.512 366.12,23.3786667 366.12,25.768 Z</Geometry>
<Geometry x:Key="Digit9">M500 0 q95.3 0 171.14 40.94 q75.84 40.94 118.12 113.43 q42.28 72.48 42.28 166.44 q0 76.51 -27.51 142.95 q-27.51 66.44 -90.61 165.77 l-230.87 370.47 l-159.73 0 l198.66 -315.44 l16.1 -24.16 q20.14 -32.21 26.85 -40.27 q-40.27 12.08 -85.91 12.08 q-91.27 0 -161.74 -40.93 q-70.47 -40.94 -109.39 -112.08 q-38.92 -71.15 -38.92 -159.74 q0 -91.27 42.95 -163.75 q42.95 -72.48 118.79 -114.09 q75.84 -41.61 169.8 -41.61 ZM501.34 504.7 q81.88 0 130.21 -53.02 q48.32 -53.02 48.32 -136.24 q0 -81.88 -49 -133.56 q-49 -51.68 -129.54 -51.68 q-81.88 0 -130.2 51.68 q-48.32 51.68 -48.32 133.56 q0 84.56 47.65 136.91 q47.65 52.35 130.87 52.35 Z</Geometry>
</ResourceDictionary>
+32 -7
View File
@@ -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">
<Grid>
<Label Content="请在下方输入名单,每行一人(建议直接粘贴表格姓名列)" Margin="10"/>
<TextBox Name="TextBoxNames" FontFamily="Microsoft YaHei UI" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" Margin="10,40,10,50" />
<Button Margin="10" VerticalAlignment="Bottom" HorizontalAlignment="Right"
Content="关闭" FontFamily="Microsoft YaHei UI"
Width="100" Click="Button_Click"/>
<Window.Resources>
<!-- 主题资源 -->
<SolidColorBrush x:Key="NamesInputWindowBackground" Color="White"/>
<SolidColorBrush x:Key="NamesInputWindowForeground" Color="Black"/>
<SolidColorBrush x:Key="NamesInputWindowButtonBackground" Color="#F4F4F5"/>
<SolidColorBrush x:Key="NamesInputWindowButtonForeground" Color="Black"/>
<SolidColorBrush x:Key="NamesInputWindowBorderBrush" Color="#E4E4E7"/>
</Window.Resources>
<Grid Background="{DynamicResource NamesInputWindowBackground}">
<Label Content="请在下方输入名单,每行一人(建议直接粘贴表格姓名列)"
Margin="10"
Foreground="{DynamicResource NamesInputWindowForeground}"
FontFamily="Microsoft YaHei UI"/>
<TextBox Name="TextBoxNames"
FontFamily="Microsoft YaHei UI"
VerticalScrollBarVisibility="Auto"
AcceptsReturn="True"
Margin="10,40,10,50"
Background="{DynamicResource NamesInputWindowBackground}"
Foreground="{DynamicResource NamesInputWindowForeground}"
BorderBrush="{DynamicResource NamesInputWindowBorderBrush}"/>
<Button Margin="10"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Content="关闭"
FontFamily="Microsoft YaHei UI"
Width="100"
Click="Button_Click"
Background="{DynamicResource NamesInputWindowButtonBackground}"
Foreground="{DynamicResource NamesInputWindowButtonForeground}"
BorderBrush="{DynamicResource NamesInputWindowBorderBrush}"/>
</Grid>
</Window>
+110
View File
@@ -1,7 +1,10 @@
using Ink_Canvas.Helpers;
using System;
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Media;
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;
namespace Ink_Canvas
{
@@ -14,6 +17,7 @@ namespace Ink_Canvas
{
InitializeComponent();
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
ApplyTheme();
}
string originText = "";
@@ -43,5 +47,111 @@ namespace Ink_Canvas
{
Close();
}
private void ApplyTheme()
{
try
{
if (MainWindow.Settings != null)
{
ApplyTheme(MainWindow.Settings);
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用名单导入窗口主题出错: {ex.Message}", LogHelper.LogType.Error);
}
}
private void ApplyTheme(Settings settings)
{
try
{
if (settings.Appearance.Theme == 0) // 浅色主题
{
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light);
ApplyThemeResources("Light");
}
else if (settings.Appearance.Theme == 1) // 深色主题
{
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark);
ApplyThemeResources("Dark");
}
else // 跟随系统主题
{
bool isSystemLight = IsSystemThemeLight();
if (isSystemLight)
{
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light);
ApplyThemeResources("Light");
}
else
{
iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark);
ApplyThemeResources("Dark");
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用名单导入窗口主题出错: {ex.Message}", LogHelper.LogType.Error);
}
}
private void ApplyThemeResources(string theme)
{
try
{
var resources = this.Resources;
if (theme == "Light")
{
// 应用浅色主题资源
resources["NamesInputWindowBackground"] = new SolidColorBrush(Color.FromRgb(255, 255, 255));
resources["NamesInputWindowForeground"] = new SolidColorBrush(Color.FromRgb(24, 24, 27));
resources["NamesInputWindowButtonBackground"] = new SolidColorBrush(Color.FromRgb(244, 244, 245));
resources["NamesInputWindowButtonForeground"] = new SolidColorBrush(Color.FromRgb(24, 24, 27));
resources["NamesInputWindowBorderBrush"] = new SolidColorBrush(Color.FromRgb(228, 228, 231));
}
else
{
// 应用深色主题资源 - 与新计时器窗口统一
resources["NamesInputWindowBackground"] = new SolidColorBrush(Color.FromRgb(31, 31, 31)); // #1f1f1f
resources["NamesInputWindowForeground"] = new SolidColorBrush(Colors.White);
resources["NamesInputWindowButtonBackground"] = new SolidColorBrush(Color.FromRgb(42, 42, 42)); // #2a2a2a
resources["NamesInputWindowButtonForeground"] = new SolidColorBrush(Colors.White);
resources["NamesInputWindowBorderBrush"] = new SolidColorBrush(Color.FromRgb(224, 224, 224)); // #E0E0E0
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用名单导入窗口主题资源出错: {ex.Message}", LogHelper.LogType.Error);
}
}
private bool IsSystemThemeLight()
{
var light = false;
try
{
var registryKey = Microsoft.Win32.Registry.CurrentUser;
var themeKey = registryKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
if (themeKey != null)
{
var value = themeKey.GetValue("AppsUseLightTheme");
if (value != null)
{
light = (int)value == 1;
}
themeKey.Close();
}
}
catch
{
// 如果无法读取注册表,默认使用浅色主题
light = true;
}
return light;
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,509 @@
<Window x:Class="Ink_Canvas.NewStyleRollCallWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:controls="clr-namespace:Ink_Canvas.Windows.Controls"
Topmost="True" Background="Transparent"
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
Loaded="RollCallWindow_Loaded" Closing="Window_Closing" WindowStartupLocation="CenterScreen"
MouseMove="Window_MouseMove" MouseEnter="Window_MouseEnter"
Title="Ink Canvas 画板 - 点名" Height="500" Width="800">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Controls/WinUI3CloseButton.xaml" />
<ResourceDictionary Source="../Resources/NewRollCallWindowResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Border Background="{DynamicResource NewRollCallWindowBackground}" CornerRadius="15" BorderThickness="1" BorderBrush="{DynamicResource NewRollCallWindowBorderBrush}" Margin="10" x:Name="MainBorder" MouseLeftButtonDown="WindowDragMove">
<Grid>
<controls:WinUI3CloseButton x:Name="CloseButton"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,0,0,0" Cursor="Hand" Click="CloseButton_Click"
Content="✕"/>
<!-- 主要内容区域 -->
<Grid>
<!-- 使用Viewbox自动缩放内容 -->
<Viewbox x:Name="MainViewController" Margin="20,20,20,20">
<Grid Height="550" Width="1000">
<!-- 顶部标题栏 -->
<Grid Height="50" Background="{DynamicResource NewRollCallWindowBackground}" x:Name="TitleBar" VerticalAlignment="Top" MouseLeftButtonDown="WindowDragMove" Margin="0,0,450,0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="22,0,0,0">
<!-- 点名图标 -->
<Path Data="M5 7C5 8.06087 5.42143 9.07828 6.17157 9.82843C6.92172 10.5786 7.93913 11 9 11C10.0609 11 11.0783 10.5786 11.8284 9.82843C12.5786 9.07828 13 8.06087 13 7C13 5.93913 12.5786 4.92172 11.8284 4.17157C11.0783 3.42143 10.0609 3 9 3C7.93913 3 6.92172 3.42143 6.17157 4.17157C5.42143 4.92172 5 5.93913 5 7Z M3 21V19C3 17.9391 3.42143 16.9217 4.17157 16.1716C4.92172 15.4214 5.93913 15 7 15H11C12.0609 15 13.0783 15.4214 13.8284 16.1716C14.5786 16.9217 15 17.9391 15 19V21 M16 3.13C16.8604 3.35031 17.623 3.85071 18.1676 4.55232C18.7122 5.25392 19.0078 6.11683 19.0078 7.005C19.0078 7.89318 18.7122 8.75608 18.1676 9.45769C17.623 10.1593 16.8604 10.6597 16 10.88 M21 21V19C20.9949 18.1172 20.6979 17.2608 20.1553 16.5644C19.6126 15.868 18.8548 15.3707 18 15.15"
Stroke="{DynamicResource NewRollCallWindowButtonForeground}"
StrokeThickness="2"
StrokeLineJoin="Round"
Fill="Transparent"
Width="24" Height="24"
Stretch="Uniform"
Margin="0,0,8,0"/>
<!-- 点名文字 -->
<TextBlock Text="点名" FontSize="28" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowTitleForeground}" x:Name="TitleText"/>
</StackPanel>
</Grid>
<!-- 主要内容区域 - 分为左右两部分 -->
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center"
x:Name="MainContentGrid" Margin="0,-25,0,25">
<!-- 左侧:结果显示区域 -->
<Grid HorizontalAlignment="Left" VerticalAlignment="Center"
x:Name="MainDisplayGrid" Width="500" Margin="-10,0,0,0">
<!-- 结果显示区域 -->
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<!-- 主结果显示 -->
<TextBlock x:Name="MainResultDisplay" Text="点击开始点名" FontSize="48" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,0,20"/>
<!-- 多结果显示区域 - 支持最多20个结果 -->
<ScrollViewer x:Name="MultiResultScrollViewer" MaxHeight="200" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled" Visibility="Collapsed">
<StackPanel x:Name="MultiResultPanel" Orientation="Vertical" HorizontalAlignment="Center">
<!-- 第1行:结果1-5 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,8">
<TextBlock x:Name="Result1Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result2Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result3Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result4Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result5Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Width="60"/>
</StackPanel>
<!-- 第2行:结果6-10 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,8">
<TextBlock x:Name="Result6Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result7Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result8Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result9Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result10Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Width="60"/>
</StackPanel>
<!-- 第3行:结果11-15 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,8">
<TextBlock x:Name="Result11Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result12Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result13Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result14Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result15Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Width="60"/>
</StackPanel>
<!-- 第4行:结果16-20 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="Result16Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result17Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result18Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result19Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Margin="0,0,12,0" Width="60"/>
<TextBlock x:Name="Result20Display" Text="" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
TextAlignment="Center" Width="60"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
<!-- 点名状态显示 -->
<TextBlock x:Name="StatusDisplay" Text="准备就绪" FontSize="16"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowSecondaryTextForeground}"
TextAlignment="Center" Margin="0,10,0,0"/>
</StackPanel>
</Grid>
<!-- 分割线 -->
<Border Width="2" Background="{DynamicResource NewRollCallWindowButtonForeground}"
Opacity="0.3" HorizontalAlignment="Left" VerticalAlignment="Stretch"
Margin="500,0,0,0"/>
<!-- 右侧:控制选项区域 -->
<Grid HorizontalAlignment="Left" VerticalAlignment="Center"
x:Name="ControlOptionsGrid" Width="450" Margin="520,0,0,0" Height="400">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<!-- 人数控制区域 -->
<Grid Margin="0,0,0,20">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="点名人数" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"
HorizontalAlignment="Center" Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="CountMinusBtn" Width="40" Height="40" Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="CountMinus_Click" Cursor="Hand" Margin="0,0,15,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="15">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<Path Data="M5 12l14 0"
Stroke="{DynamicResource NewRollCallWindowButtonForeground}"
StrokeThickness="2"
StrokeStartLineCap="Round"
StrokeEndLineCap="Round"
StrokeLineJoin="Round"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"/>
</Button>
<TextBlock x:Name="CountDisplay" Text="1" FontSize="24" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
Width="60" TextAlignment="Center"/>
<Button x:Name="CountPlusBtn" Width="40" Height="40" Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="CountPlus_Click" Cursor="Hand" Margin="15,0,0,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="15">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<Path Data="M12 5l0 14 M5 12l14 0"
Stroke="{DynamicResource NewRollCallWindowButtonForeground}"
StrokeThickness="2"
StrokeStartLineCap="Round"
StrokeEndLineCap="Round"
StrokeLineJoin="Round"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"/>
</Button>
</StackPanel>
</StackPanel>
</Grid>
<!-- 点名模式选择 -->
<Grid Margin="0,0,0,20">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="点名模式" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"
HorizontalAlignment="Center" Margin="0,0,0,10"/>
<Border Background="{DynamicResource NewRollCallWindowButtonBackground}"
CornerRadius="8"
BorderThickness="1"
BorderBrush="#616161"
Width="300" Height="40">
<Grid>
<!-- 背景指示器 -->
<Border x:Name="SegmentedIndicator"
Background="{DynamicResource NewRollCallWindowPrimaryButtonBackground}"
CornerRadius="7.5,0,0,7.5"
Width="100" Height="38"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="0,0,0,0"/>
<!-- 按钮容器 -->
<Grid>
<Button x:Name="RandomModeBtn"
Width="100" Height="40"
Background="Transparent"
BorderThickness="0"
Click="RandomMode_Click"
Cursor="Hand"
HorizontalAlignment="Left">
<TextBlock x:Name="RandomModeText" Text="随机点名" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</Button>
<Button x:Name="SequentialModeBtn"
Width="100" Height="40"
Background="Transparent"
BorderThickness="0"
Click="SequentialMode_Click"
Cursor="Hand"
HorizontalAlignment="Center">
<TextBlock x:Name="SequentialModeText" Text="顺序点名" FontSize="16" FontWeight="Normal"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}" Opacity="0.6"/>
</Button>
<Button x:Name="GroupModeBtn"
Width="100" Height="40"
Background="Transparent"
BorderThickness="0"
Click="GroupMode_Click"
Cursor="Hand"
HorizontalAlignment="Right">
<TextBlock x:Name="GroupModeText" Text="分组点名" FontSize="16" FontWeight="Normal"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}" Opacity="0.6"/>
</Button>
</Grid>
</Grid>
</Border>
</StackPanel>
</Grid>
<!-- 外部点名区域 -->
<Grid Margin="0,0,0,20">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="外部点名" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"
HorizontalAlignment="Center" Margin="0,0,0,10"/>
<!-- 外部点名类型切换 -->
<Border Background="{DynamicResource NewRollCallWindowButtonBackground}"
CornerRadius="8"
BorderThickness="1"
BorderBrush="#616161"
Width="360" Height="40">
<Grid>
<!-- 背景指示器 -->
<Border x:Name="ExternalCallerIndicator"
Background="{DynamicResource NewRollCallWindowPrimaryButtonBackground}"
CornerRadius="7.5,0,0,7.5"
Width="120" Height="38"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="0,0,0,0"/>
<!-- 按钮容器 -->
<Grid>
<Button x:Name="ClassIslandBtn"
Width="120" Height="40"
Background="Transparent"
BorderThickness="0"
Click="ClassIsland_Click"
Cursor="Hand"
HorizontalAlignment="Left">
<TextBlock x:Name="ClassIslandText" Text="ClassIsland" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</Button>
<Button x:Name="SecRandomBtn"
Width="120" Height="40"
Background="Transparent"
BorderThickness="0"
Click="SecRandom_Click"
Cursor="Hand"
HorizontalAlignment="Center">
<TextBlock x:Name="SecRandomText" Text="SecRandom" FontSize="16" FontWeight="Normal"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}" Opacity="0.6"/>
</Button>
<Button x:Name="NamePickerBtn"
Width="120" Height="40"
Background="Transparent"
BorderThickness="0"
Click="NamePicker_Click"
Cursor="Hand"
HorizontalAlignment="Right">
<TextBlock x:Name="NamePickerText" Text="NamePicker" FontSize="16" FontWeight="Normal"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}" Opacity="0.6"/>
</Button>
</Grid>
</Grid>
</Border>
</StackPanel>
</Grid>
<!-- 名单管理区域 -->
<Grid Margin="0,0,0,20">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Text="名单管理" FontSize="16" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"
HorizontalAlignment="Center" Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="ImportListBtn" Width="90" Height="40" Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="ImportList_Click" Cursor="Hand" Margin="0,0,10,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="导入名单" FontSize="14"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</Button>
<Button x:Name="ClearListBtn" Width="90" Height="40" Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="ClearList_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<TextBlock Text="清空名单" FontSize="14"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</Button>
</StackPanel>
</StackPanel>
</Grid>
<!-- 名单统计信息 -->
<Grid Margin="0,0,0,20">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock x:Name="ListCountDisplay" Text="名单人数: 0" FontSize="14"
Foreground="{DynamicResource NewRollCallWindowSecondaryTextForeground}"
HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</Grid>
<!-- 底部控制按钮区域 -->
<Grid HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,20">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<!-- 外部点名按钮 -->
<Button x:Name="ExternalCallerBtn" Width="140" Height="60"
Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="ExternalCaller_Click" Cursor="Hand" Margin="0,0,20,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="30">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Data="M9 15L15 9 M11 6L11.463 5.464C12.4008 4.52633 13.6727 3.9996 14.9989 3.99969C16.325 3.99979 17.5968 4.52669 18.5345 5.4645C19.4722 6.40231 19.9989 7.67419 19.9988 9.00035C19.9987 10.3265 19.4718 11.5983 18.534 12.536L18 13 M13.0001 18L12.6031 18.534C11.6544 19.4722 10.3739 19.9984 9.03964 19.9984C7.70535 19.9984 6.42489 19.4722 5.47614 18.534C5.0085 18.0716 4.63724 17.521 4.38385 16.9141C4.13047 16.3073 4 15.6561 4 14.9985C4 14.3408 4.13047 13.6897 4.38385 13.0829C4.63724 12.476 5.0085 11.9254 5.47614 11.463L6.00014 11"
Stroke="{DynamicResource NewRollCallWindowButtonForeground}"
StrokeThickness="2"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"
Margin="0,0,8,0"/>
<TextBlock Text="外部点名" FontSize="18" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</StackPanel>
</Button>
<!-- 开始点名按钮 -->
<Button x:Name="StartRollCallBtn" Width="140" Height="60" Background="{DynamicResource NewRollCallWindowPrimaryButtonBackground}"
BorderThickness="0" Click="StartRollCall_Click" Cursor="Hand" Margin="0,0,20,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="30">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Data="M5 7C5 8.06087 5.42143 9.07828 6.17157 9.82843C6.92172 10.5786 7.93913 11 9 11C10.0609 11 11.0783 10.5786 11.8284 9.82843C12.5786 9.07828 13 8.06087 13 7C13 5.93913 12.5786 4.92172 11.8284 4.17157C11.0783 3.42143 10.0609 3 9 3C7.93913 3 6.92172 3.42143 6.17157 4.17157C5.42143 4.92172 5 5.93913 5 7Z M3 21V19C3 17.9391 3.42143 16.9217 4.17157 16.1716C4.92172 15.4214 5.93913 15 7 15H11C12.0609 15 13.0783 15.4214 13.8284 16.1716C14.5786 16.9217 15 17.9391 15 19V21 M16 3.13C16.8604 3.35031 17.623 3.85071 18.1676 4.55232C18.7122 5.25392 19.0078 6.11683 19.0078 7.005C19.0078 7.89318 18.7122 8.75608 18.1676 9.45769C17.623 10.1593 16.8604 10.6597 16 10.88 M21 21V19C20.9949 18.1172 20.6979 17.2608 20.1553 16.5644C19.6126 15.868 18.8548 15.3707 18 15.15"
Stroke="{DynamicResource NewRollCallWindowPrimaryButtonForeground}"
StrokeThickness="2"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"
Margin="0,0,8,0"/>
<TextBlock Text="开始点名" FontSize="18" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowPrimaryButtonForeground}"/>
</StackPanel>
</Button>
<!-- 停止点名按钮 -->
<Button x:Name="StopRollCallBtn" Width="100" Height="60" Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="StopRollCall_Click" Cursor="Hand" Margin="0,0,20,0" Visibility="Collapsed">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="30">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Data="M6 6l12 12 M18 6l-12 12"
Stroke="{DynamicResource NewRollCallWindowButtonForeground}"
StrokeThickness="2"
StrokeLineJoin="Round"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"
Margin="0,0,8,0"/>
<TextBlock Text="停止" FontSize="18" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</StackPanel>
</Button>
<!-- 重置按钮 -->
<Button x:Name="ResetBtn" Width="140" Height="60" Background="{DynamicResource NewRollCallWindowButtonBackground}"
BorderThickness="0" Click="Reset_Click" Cursor="Hand">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="30">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Data="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4 M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"
Stroke="{DynamicResource NewRollCallWindowButtonForeground}"
StrokeThickness="2"
StrokeLineJoin="Round"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"
Margin="0,0,8,0"/>
<TextBlock Text="重置" FontSize="18" FontWeight="Bold"
Foreground="{DynamicResource NewRollCallWindowButtonForeground}"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
</Viewbox>
</Grid>
</Grid>
</Border>
</Window>
+104 -30
View File
@@ -6,9 +6,12 @@ using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Shapes;
using Newtonsoft.Json;
using System.Runtime.InteropServices;
using System.Windows.Threading;
namespace Ink_Canvas
{
@@ -46,6 +49,9 @@ namespace Ink_Canvas
hideTimer = new Timer(1000); // 每秒检查一次
hideTimer.Elapsed += HideTimer_Elapsed;
lastActivityTime = DateTime.Now;
// 添加窗口加载事件处理,确保置顶
Loaded += TimerWindow_Loaded;
}
@@ -331,6 +337,9 @@ namespace Ink_Canvas
minimizedWindow = new MinimizedTimerWindow(this);
minimizedWindow.Show();
// 确保最小化窗口也置顶
minimizedWindow.Topmost = true;
// 隐藏主窗口
this.Hide();
}
@@ -777,6 +786,9 @@ namespace Ink_Canvas
// 启动隐藏定时器
hideTimer.Start();
// 确保计时器窗口置顶
ApplyTimerWindowTopmost();
// 保存到最近计时记录
SaveRecentTimer();
}
@@ -879,36 +891,6 @@ namespace Ink_Canvas
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
isTimerRunning = false;
if (MainWindow.Settings != null)
{
var mainWindow = Application.Current.MainWindow as MainWindow;
if (mainWindow != null)
{
try
{
var currentModeField = mainWindow.GetType().GetField("currentMode",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (currentModeField != null)
{
int currentMode = (int)currentModeField.GetValue(mainWindow);
if (currentMode == 1) // 白板模式
{
mainWindow.Topmost = false; // 保持白板模式下的非置顶状态
}
else
{
mainWindow.Topmost = true; // 其他模式恢复置顶
}
}
}
catch
{
// 如果反射失败,使用默认行为
mainWindow.Topmost = true;
}
}
}
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
@@ -1329,6 +1311,9 @@ namespace Ink_Canvas
fullscreenWindow = new FullscreenTimerWindow(this);
fullscreenWindow.Show();
// 确保全屏窗口也置顶
fullscreenWindow.Topmost = true;
// 隐藏主窗口
this.Hide();
}
@@ -1342,6 +1327,8 @@ namespace Ink_Canvas
this.Show();
this.Activate();
this.WindowState = WindowState.Normal;
// 重新应用置顶
ApplyTimerWindowTopmost();
}
else if (fullscreenWindow != null)
{
@@ -1351,7 +1338,94 @@ namespace Ink_Canvas
this.Show();
this.Activate();
this.WindowState = WindowState.Normal;
// 重新应用置顶
ApplyTimerWindowTopmost();
}
}
#region Win32 API
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
private static extern bool IsWindow(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern bool IsIconic(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("kernel32.dll")]
private static extern uint GetCurrentProcessId();
private const int GWL_EXSTYLE = -20;
private const int WS_EX_TOPMOST = 0x00000008;
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
private static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
private const uint SWP_NOMOVE = 0x0002;
private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOACTIVATE = 0x0010;
private const uint SWP_SHOWWINDOW = 0x0040;
private const uint SWP_NOOWNERZORDER = 0x0200;
/// <summary>
/// 应用计时器窗口置顶
/// </summary>
private void ApplyTimerWindowTopmost()
{
try
{
var hwnd = new WindowInteropHelper(this).Handle;
if (hwnd == IntPtr.Zero) return;
// 强制激活窗口
Activate();
Focus();
// 设置WPF的Topmost属性
Topmost = true;
// 使用Win32 API强制置顶
// 1. 设置窗口样式为置顶
int exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TOPMOST);
// 2. 使用SetWindowPos确保窗口在最顶层
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
LogHelper.WriteLogToFile("计时器窗口已应用置顶", LogHelper.LogType.Trace);
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用计时器窗口置顶失败: {ex.Message}", LogHelper.LogType.Error);
}
}
/// <summary>
/// 窗口加载事件处理,确保置顶
/// </summary>
private void TimerWindow_Loaded(object sender, RoutedEventArgs e)
{
// 使用延迟确保窗口完全加载后再应用置顶
Dispatcher.BeginInvoke(new Action(() =>
{
ApplyTimerWindowTopmost();
}), DispatcherPriority.Loaded);
}
#endregion
}
}
@@ -0,0 +1,125 @@
using Ink_Canvas.Helpers;
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Runtime.InteropServices;
using System.Windows.Threading;
namespace Ink_Canvas
{
/// <summary>
/// 快抽悬浮按钮
/// </summary>
public partial class QuickDrawFloatingButton : Window
{
public QuickDrawFloatingButton()
{
InitializeComponent();
// 设置无焦点状态
this.Focusable = false;
this.ShowInTaskbar = false;
}
private void FloatingButton_Loaded(object sender, RoutedEventArgs e)
{
// 设置位置到屏幕右下角稍微靠近中部
SetPositionToBottomRight();
// 应用置顶
ApplyFloatingButtonTopmost();
}
private void SetPositionToBottomRight()
{
try
{
// 获取主屏幕的工作区域
var workingArea = SystemParameters.WorkArea;
this.Left = workingArea.Right - this.Width - 0;
this.Top = workingArea.Bottom - this.Height - 200;
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"设置悬浮按钮位置失败: {ex.Message}", LogHelper.LogType.Error);
// 如果计算失败,使用默认位置
this.Left = 720;
this.Top = 400;
}
}
private void FloatingButton_Click(object sender, MouseButtonEventArgs e)
{
try
{
// 打开快抽窗口
var quickDrawWindow = new QuickDrawWindow();
quickDrawWindow.ShowDialog();
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"打开快抽窗口失败: {ex.Message}", LogHelper.LogType.Error);
}
}
#region Win32 API
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_EXSTYLE = -20;
private const int WS_EX_TOPMOST = 0x00000008;
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
private const uint SWP_NOMOVE = 0x0002;
private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOACTIVATE = 0x0010;
private const uint SWP_SHOWWINDOW = 0x0040;
private const uint SWP_NOOWNERZORDER = 0x0200;
/// <summary>
/// 应用悬浮按钮置顶
/// </summary>
private void ApplyFloatingButtonTopmost()
{
try
{
var hwnd = new WindowInteropHelper(this).Handle;
if (hwnd == IntPtr.Zero) return;
// 强制激活窗口
Activate();
Focus();
// 设置WPF的Topmost属性
Topmost = true;
// 使用Win32 API强制置顶
// 1. 设置窗口样式为置顶
int exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TOPMOST);
// 2. 使用SetWindowPos确保窗口在最顶层
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
LogHelper.WriteLogToFile("快抽悬浮按钮已应用置顶", LogHelper.LogType.Trace);
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用快抽悬浮按钮置顶失败: {ex.Message}", LogHelper.LogType.Error);
}
}
#endregion
}
}
@@ -0,0 +1,43 @@
<Window x:Class="Ink_Canvas.QuickDrawFloatingButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Topmost="True" Background="Transparent"
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
Loaded="FloatingButton_Loaded" WindowStartupLocation="Manual"
ShowInTaskbar="False" Focusable="False"
Title="快抽悬浮按钮" Height="45" Width="45">
<Window.Resources>
<ResourceDictionary>
<!-- 悬浮按钮资源 -->
<SolidColorBrush x:Key="QuickDrawFloatingButtonBackground" Color="#80000000"/>
<SolidColorBrush x:Key="QuickDrawFloatingButtonBorderBrush" Color="#40000000"/>
<SolidColorBrush x:Key="QuickDrawFloatingButtonIconForeground" Color="White"/>
</ResourceDictionary>
</Window.Resources>
<Border Background="{DynamicResource QuickDrawFloatingButtonBackground}"
CornerRadius="8"
BorderThickness="1"
BorderBrush="{DynamicResource QuickDrawFloatingButtonBorderBrush}"
MouseLeftButtonDown="FloatingButton_Click"
Cursor="Hand">
<Border.Effect>
<DropShadowEffect Color="Black" Direction="315" ShadowDepth="3" Opacity="0.3" BlurRadius="5"/>
</Border.Effect>
<Grid>
<Path Data="M5 7C5 8.06087 5.42143 9.07828 6.17157 9.82843C6.92172 10.5786 7.93913 11 9 11C10.0609 11 11.0783 10.5786 11.8284 9.82843C12.5786 9.07828 13 8.06087 13 7C13 5.93913 12.5786 4.92172 11.8284 4.17157C11.0783 3.42143 10.0609 3 9 3C7.93913 3 6.92172 3.42143 6.17157 4.17157C5.42143 4.92172 5 5.93913 5 7Z M3 21V19C3 17.9391 3.42143 16.9217 4.17157 16.1716C4.92172 15.4214 5.93913 15 7 15H11C12.0609 15 13.0783 15.4214 13.8284 16.1716C14.5786 16.9217 15 17.9391 15 19V21 M16 3.13C16.8604 3.35031 17.623 3.85071 18.1676 4.55232C18.7122 5.25392 19.0078 6.11683 19.0078 7.005C19.0078 7.89318 18.7122 8.75608 18.1676 9.45769C17.623 10.1593 16.8604 10.6597 16 10.88 M21 21V19C20.9949 18.1172 20.6979 17.2608 20.1553 16.5644C19.6126 15.868 18.8548 15.3707 18 15.15"
Stroke="{DynamicResource QuickDrawFloatingButtonIconForeground}"
StrokeThickness="2"
StrokeLineJoin="Round"
Fill="Transparent"
Width="20" Height="20"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
</Window>
+283
View File
@@ -0,0 +1,283 @@
using Ink_Canvas.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Threading;
using System.Runtime.InteropServices;
using Newtonsoft.Json;
using System.IO;
namespace Ink_Canvas
{
/// <summary>
/// 快抽窗口
/// </summary>
public partial class QuickDrawWindow : Window
{
private Random random = new Random();
private int autoCloseWaitTime = 2500; // 自动关闭等待时间(毫秒)
private List<string> nameList = new List<string>(); // 名单列表
public QuickDrawWindow()
{
InitializeComponent();
this.Focusable = false;
this.ShowInTaskbar = false;
InitializeSettings();
LoadNamesFromFile();
StartQuickDraw();
}
private void InitializeSettings()
{
try
{
if (MainWindow.Settings?.RandSettings != null)
{
autoCloseWaitTime = (int)MainWindow.Settings.RandSettings.RandWindowOnceCloseLatency * 1000;
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"初始化快抽窗口设置失败: {ex.Message}", LogHelper.LogType.Error);
}
}
private void LoadNamesFromFile()
{
try
{
string namesFilePath = App.RootPath + "Names.txt";
if (File.Exists(namesFilePath))
{
string content = File.ReadAllText(namesFilePath);
nameList = content.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)
.Select(name => name.Trim())
.Where(name => !string.IsNullOrEmpty(name))
.ToList();
}
else
{
nameList.Clear();
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"加载名单文件失败: {ex.Message}", LogHelper.LogType.Error);
nameList.Clear();
}
}
private void StartQuickDraw()
{
try
{
// 延迟100ms后开始抽选动画
new System.Threading.Thread(() =>
{
System.Threading.Thread.Sleep(100);
Application.Current.Dispatcher.Invoke(() =>
{
StartQuickDrawAnimation();
});
}).Start();
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"开始快抽失败: {ex.Message}", LogHelper.LogType.Error);
}
}
/// <summary>
/// 快抽动画
/// </summary>
private void StartQuickDrawAnimation()
{
const int animationTimes = 100; // 动画次数
const int sleepTime = 5; // 每次动画间隔(毫秒)
new System.Threading.Thread(() =>
{
if (nameList.Count > 0)
{
// 有名单时,从名单中抽选
StartNameDrawAnimation(animationTimes, sleepTime);
}
else
{
// 没有名单时,从1-60数字中抽选
StartNumberDrawAnimation(animationTimes, sleepTime);
}
}).Start();
}
/// <summary>
/// 名单抽选动画
/// </summary>
private void StartNameDrawAnimation(int animationTimes, int sleepTime)
{
List<string> usedNames = new List<string>();
for (int i = 0; i < animationTimes; i++)
{
// 随机选择一个名字进行动画显示,避免立即重复
string randomName;
do
{
randomName = nameList[random.Next(0, nameList.Count)];
} while (usedNames.Count > 0 && usedNames[usedNames.Count - 1] == randomName);
usedNames.Add(randomName);
Application.Current.Dispatcher.Invoke(() =>
{
MainResultDisplay.Text = randomName;
});
System.Threading.Thread.Sleep(sleepTime);
}
// 动画结束,显示最终结果
Application.Current.Dispatcher.Invoke(() =>
{
// 随机选择一个最终名字
string finalName = nameList[random.Next(0, nameList.Count)];
MainResultDisplay.Text = finalName;
});
// 显示结果后,等待一段时间让用户看到结果,然后关闭窗口
new System.Threading.Thread(() =>
{
System.Threading.Thread.Sleep(autoCloseWaitTime);
Application.Current.Dispatcher.Invoke(() =>
{
Close();
});
}).Start();
}
/// <summary>
/// 数字抽选动画
/// </summary>
private void StartNumberDrawAnimation(int animationTimes, int sleepTime)
{
List<int> usedNumbers = new List<int>();
for (int i = 0; i < animationTimes; i++)
{
// 随机选择一个数字进行动画显示,避免立即重复
int randomNumber;
do
{
randomNumber = random.Next(1, 61); // 1-60
} while (usedNumbers.Count > 0 && usedNumbers[usedNumbers.Count - 1] == randomNumber);
usedNumbers.Add(randomNumber);
Application.Current.Dispatcher.Invoke(() =>
{
MainResultDisplay.Text = randomNumber.ToString();
});
System.Threading.Thread.Sleep(sleepTime);
}
// 动画结束,显示最终结果
Application.Current.Dispatcher.Invoke(() =>
{
// 随机选择一个最终数字
int finalNumber = random.Next(1, 61);
MainResultDisplay.Text = finalNumber.ToString();
});
// 显示结果后,等待一段时间让用户看到结果,然后关闭窗口
new System.Threading.Thread(() =>
{
System.Threading.Thread.Sleep(autoCloseWaitTime);
Application.Current.Dispatcher.Invoke(() =>
{
Close();
});
}).Start();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
// 窗口关闭时的清理工作
}
private void WindowDragMove(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
DragMove();
}
#region Win32 API
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private const int GWL_EXSTYLE = -20;
private const int WS_EX_TOPMOST = 0x00000008;
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
private const uint SWP_NOMOVE = 0x0002;
private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOACTIVATE = 0x0010;
private const uint SWP_SHOWWINDOW = 0x0040;
private const uint SWP_NOOWNERZORDER = 0x0200;
/// <summary>
/// 应用快抽窗口置顶
/// </summary>
private void ApplyQuickDrawWindowTopmost()
{
try
{
var hwnd = new WindowInteropHelper(this).Handle;
if (hwnd == IntPtr.Zero) return;
// 设置WPF的Topmost属性
Topmost = true;
// 使用Win32 API强制置顶
// 1. 设置窗口样式为置顶
int exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TOPMOST);
// 2. 使用SetWindowPos确保窗口在最顶层
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
LogHelper.WriteLogToFile("快抽窗口已应用置顶", LogHelper.LogType.Trace);
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用快抽窗口置顶失败: {ex.Message}", LogHelper.LogType.Error);
}
}
/// <summary>
/// 窗口加载事件处理,确保置顶
/// </summary>
private void QuickDrawWindow_Loaded(object sender, RoutedEventArgs e)
{
// 使用延迟确保窗口完全加载后再应用置顶
Dispatcher.BeginInvoke(new Action(() =>
{
ApplyQuickDrawWindowTopmost();
}), DispatcherPriority.Loaded);
}
#endregion
}
}
+77
View File
@@ -0,0 +1,77 @@
<Window x:Class="Ink_Canvas.QuickDrawWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas"
Topmost="True" Background="Transparent"
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
Loaded="QuickDrawWindow_Loaded" Closing="Window_Closing" WindowStartupLocation="CenterScreen"
Title="快抽窗口" Height="200" Width="400" Focusable="False" ShowInTaskbar="False">
<Window.Resources>
<ResourceDictionary>
<!-- 快抽窗口资源 -->
<SolidColorBrush x:Key="QuickDrawWindowBackground" Color="#1f1f1f"/>
<SolidColorBrush x:Key="QuickDrawWindowBorderBrush" Color="#E0E0E0"/>
<SolidColorBrush x:Key="QuickDrawWindowTitleForeground" Color="White"/>
<SolidColorBrush x:Key="QuickDrawWindowDigitForeground" Color="White"/>
</ResourceDictionary>
</Window.Resources>
<Border Background="{DynamicResource QuickDrawWindowBackground}"
CornerRadius="15"
BorderThickness="1"
BorderBrush="{DynamicResource QuickDrawWindowBorderBrush}"
Margin="10"
x:Name="MainBorder"
MouseLeftButtonDown="WindowDragMove">
<Grid>
<!-- 主要内容区域 -->
<Grid>
<!-- 顶部标题栏 -->
<Grid Height="50" Background="{DynamicResource QuickDrawWindowBackground}"
x:Name="TitleBar"
VerticalAlignment="Top"
MouseLeftButtonDown="WindowDragMove"
Margin="10,8,40,0">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="22,0,0,0">
<!-- 快抽图标 -->
<Path Data="M5 7C5 8.06087 5.42143 9.07828 6.17157 9.82843C6.92172 10.5786 7.93913 11 9 11C10.0609 11 11.0783 10.5786 11.8284 9.82843C12.5786 9.07828 13 8.06087 13 7C13 5.93913 12.5786 4.92172 11.8284 4.17157C11.0783 3.42143 10.0609 3 9 3C7.93913 3 6.92172 3.42143 6.17157 4.17157C5.42143 4.92172 5 5.93913 5 7Z M3 21V19C3 17.9391 3.42143 16.9217 4.17157 16.1716C4.92172 15.4214 5.93913 15 7 15H11C12.0609 15 13.0783 15.4214 13.8284 16.1716C14.5786 16.9217 15 17.9391 15 19V21 M16 3.13C16.8604 3.35031 17.623 3.85071 18.1676 4.55232C18.7122 5.25392 19.0078 6.11683 19.0078 7.005C19.0078 7.89318 18.7122 8.75608 18.1676 9.45769C17.623 10.1593 16.8604 10.6597 16 10.88 M21 21V19C20.9949 18.1172 20.6979 17.2608 20.1553 16.5644C19.6126 15.868 18.8548 15.3707 18 15.15"
Stroke="{DynamicResource QuickDrawWindowTitleForeground}"
StrokeThickness="2"
StrokeLineJoin="Round"
Fill="Transparent"
Width="24" Height="24"
Stretch="Uniform"
Margin="0,0,8,0"/>
<!-- 快抽文字 -->
<TextBlock Text="快抽" FontSize="20" FontWeight="Bold"
Foreground="{DynamicResource QuickDrawWindowTitleForeground}"
x:Name="TitleText"/>
</StackPanel>
</Grid>
<!-- 主要内容区域 -->
<Grid Margin="20,60,20,20">
<!-- 结果显示区域 -->
<Grid x:Name="ResultGrid" HorizontalAlignment="Center" VerticalAlignment="Center">
<!-- 主结果显示 -->
<TextBlock x:Name="MainResultDisplay"
Text="准备抽选..."
FontSize="48"
FontWeight="Bold"
Foreground="{DynamicResource QuickDrawWindowDigitForeground}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextAlignment="Center"/>
</Grid>
</Grid>
</Grid>
</Grid>
</Border>
</Window>
+2
View File
@@ -100,3 +100,5 @@ ICC CE 1.7.X.X更新日志
99. 修复仅调色盘状态下浮动栏不居中
100. 修复希沃白板查杀与思锐希沃启动器导致的重复启动
101. 新增UIA窗口置顶
102. 新增新点名窗口
103. 新增点名快抽