diff --git a/AutomaticUpdateVersionControl.txt b/AutomaticUpdateVersionControl.txt index 784b0d37..5ad6231c 100644 --- a/AutomaticUpdateVersionControl.txt +++ b/AutomaticUpdateVersionControl.txt @@ -1 +1 @@ -1.7.12.0 +1.7.13.0 diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index f524565a..1e04932d 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -1,19 +1,15 @@ using Hardcodet.Wpf.TaskbarNotification; using Ink_Canvas.Helpers; -using Ink_Canvas.Windows; using iNKORE.UI.WPF.Modern.Controls; using Microsoft.Win32; using Newtonsoft.Json; using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Runtime.InteropServices; -using System.Security; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; @@ -36,7 +32,7 @@ namespace Ink_Canvas public static string[] StartArgs; public static string RootPath = Environment.GetEnvironmentVariable("APPDATA") + "\\Ink Canvas\\"; - + // 新增:标记是否通过--board参数启动 public static bool StartWithBoardMode = false; // 新增:标记是否通过--show参数启动 @@ -302,7 +298,7 @@ namespace Ink_Canvas { string reason = e.Reason == SessionEndReasons.Logoff ? "用户注销" : "系统关机"; WriteCrashLog($"系统会话即将结束: {reason}"); - + // 清理PowerPoint进程守护和悬浮窗拦截器 try { @@ -311,13 +307,13 @@ namespace Ink_Canvas if (mainWindow != null) { // 清理PowerPoint进程守护 - var method = mainWindow.GetType().GetMethod("StopPowerPointProcessMonitoring", + var method = mainWindow.GetType().GetMethod("StopPowerPointProcessMonitoring", BindingFlags.NonPublic | BindingFlags.Instance); method?.Invoke(mainWindow, null); WriteCrashLog("PowerPoint进程守护已在系统关机时清理"); - + // 清理悬浮窗拦截器 - var interceptorField = mainWindow.GetType().GetField("_floatingWindowInterceptorManager", + var interceptorField = mainWindow.GetType().GetField("_floatingWindowInterceptorManager", BindingFlags.NonPublic | BindingFlags.Instance); var interceptorManager = interceptorField?.GetValue(mainWindow); if (interceptorManager != null) @@ -331,7 +327,7 @@ namespace Ink_Canvas { WriteCrashLog($"清理资源失败: {ex.Message}"); } - + DeviceIdentifier.SaveUsageStatsOnShutdown(); } @@ -409,12 +405,12 @@ namespace Ink_Canvas public static void ShowSplashScreen() { - if (_isSplashScreenShown) + if (_isSplashScreenShown) { LogHelper.WriteLogToFile("启动画面已经显示,跳过重复显示"); return; } - + try { LogHelper.WriteLogToFile("开始创建启动画面..."); @@ -435,7 +431,7 @@ namespace Ink_Canvas public static void CloseSplashScreen() { if (!_isSplashScreenShown || _splashScreen == null) return; - + try { _splashScreen.CloseSplashScreen(); @@ -481,7 +477,7 @@ namespace Ink_Canvas return (bool)obj["appearance"]["enableSplashScreen"]; } } - + // 如果设置文件不存在或没有该设置,返回默认值false return false; } @@ -596,8 +592,8 @@ namespace Ink_Canvas ShowSplashScreen(); SetSplashMessage("正在启动 Ink Canvas..."); SetSplashProgress(20); - await Task.Delay(500); - + await Task.Delay(500); + // 强制刷新UI,确保启动画面显示 Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); } @@ -610,7 +606,7 @@ namespace Ink_Canvas // 检查是否为最终应用启动(更新后的应用) bool isFinalApp = e.Args.Contains("--final-app"); bool skipMutexCheck = e.Args.Contains("--skip-mutex-check"); - + // 检查是否通过--board参数启动 bool hasBoardArg = e.Args.Contains("--board"); if (hasBoardArg) @@ -638,8 +634,8 @@ namespace Ink_Canvas { SetSplashMessage("正在初始化组件..."); SetSplashProgress(40); - await Task.Delay(500); - } + await Task.Delay(500); + } try { IACoreDllExtractor.ExtractIACoreDlls(); @@ -654,8 +650,8 @@ namespace Ink_Canvas { SetSplashMessage("正在加载配置..."); SetSplashProgress(60); - await Task.Delay(500); - } + await Task.Delay(500); + } DeviceIdentifier.RecordAppLaunch(); LogHelper.WriteLogToFile($"App | 设备ID: {DeviceIdentifier.GetDeviceId()}"); LogHelper.WriteLogToFile($"App | 使用频率: {DeviceIdentifier.GetUsageFrequency()}"); @@ -902,11 +898,11 @@ namespace Ink_Canvas { SetSplashMessage("正在初始化主界面..."); SetSplashProgress(80); - await Task.Delay(500); - } + await Task.Delay(500); + } var mainWindow = new MainWindow(); MainWindow = mainWindow; - + // 主窗口加载完成后关闭启动画面 mainWindow.Loaded += (s, args) => { @@ -929,7 +925,7 @@ namespace Ink_Canvas }); } }; - + mainWindow.Show(); // 注册.icstk文件关联 diff --git a/Ink Canvas/AssemblyInfo.cs b/Ink Canvas/AssemblyInfo.cs index 16ecbd01..567d00bd 100644 --- a/Ink Canvas/AssemblyInfo.cs +++ b/Ink Canvas/AssemblyInfo.cs @@ -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.12.0")] -[assembly: AssemblyFileVersion("1.7.12.0")] +[assembly: AssemblyVersion("1.7.13.0")] +[assembly: AssemblyFileVersion("1.7.13.0")] diff --git a/Ink Canvas/FloatingWindowInterceptorManager.cs b/Ink Canvas/FloatingWindowInterceptorManager.cs index 9abd6a00..031220f5 100644 --- a/Ink Canvas/FloatingWindowInterceptorManager.cs +++ b/Ink Canvas/FloatingWindowInterceptorManager.cs @@ -1,7 +1,7 @@ +using Ink_Canvas.Helpers; using System; using System.Collections.Generic; using System.Linq; -using Ink_Canvas.Helpers; namespace Ink_Canvas { @@ -46,7 +46,7 @@ namespace Ink_Canvas { _settings = settings ?? new FloatingWindowInterceptorSettings(); _interceptor = new FloatingWindowInterceptor(); - + // 订阅事件 _interceptor.WindowIntercepted += OnWindowIntercepted; _interceptor.WindowRestored += OnWindowRestored; @@ -116,7 +116,7 @@ namespace Ink_Canvas try { _interceptor.SetInterceptRule(type, enabled); - + // 更新设置 var ruleName = type.ToString(); if (_settings.InterceptRules.ContainsKey(ruleName)) @@ -258,7 +258,7 @@ namespace Ink_Canvas try { _settings.ScanIntervalMs = intervalMs; - + // 如果正在运行,重启以应用新间隔 if (IsRunning) { diff --git a/Ink Canvas/Helpers/AdvancedBezierSmoothing.cs b/Ink Canvas/Helpers/AdvancedBezierSmoothing.cs index 51d0588f..cde8b253 100644 --- a/Ink Canvas/Helpers/AdvancedBezierSmoothing.cs +++ b/Ink Canvas/Helpers/AdvancedBezierSmoothing.cs @@ -732,9 +732,9 @@ namespace Ink_Canvas.Helpers /// public class AdvancedBezierSmoothing { - public double SmoothingStrength { get; set; } = 0.6; - public double ResampleInterval { get; set; } = 2.0; - public int InterpolationSteps { get; set; } = 12; + public double SmoothingStrength { get; set; } = 0.6; + public double ResampleInterval { get; set; } = 2.0; + public int InterpolationSteps { get; set; } = 12; public Stroke SmoothStroke(Stroke stroke) { @@ -764,7 +764,7 @@ namespace Ink_Canvas.Helpers { DrawingAttributes = stroke.DrawingAttributes.Clone() }; - + System.Diagnostics.Debug.WriteLine($"AdvancedBezierSmoothing: 创建平滑笔画成功"); return smoothedStroke; } @@ -797,7 +797,7 @@ namespace Ink_Canvas.Helpers // 只生成2-3个插值点 int steps = 2; - + // 生成贝塞尔曲线点 for (int j = 1; j <= steps; j++) { @@ -808,7 +808,7 @@ namespace Ink_Canvas.Helpers } result.Add(points[points.Length - 1]); - + // 去重处理 return RemoveDuplicatePoints(result.ToArray()); } @@ -827,10 +827,10 @@ namespace Ink_Canvas.Helpers { var lastPoint = result[result.Count - 1]; var currentPoint = points[i]; - - double distance = Math.Sqrt(Math.Pow(currentPoint.X - lastPoint.X, 2) + + + double distance = Math.Sqrt(Math.Pow(currentPoint.X - lastPoint.X, 2) + Math.Pow(currentPoint.Y - lastPoint.Y, 2)); - + if (distance > minDistance) { result.Add(currentPoint); diff --git a/Ink Canvas/Helpers/AutoBackupManager.cs b/Ink Canvas/Helpers/AutoBackupManager.cs index badd4ecf..bac26b53 100644 --- a/Ink Canvas/Helpers/AutoBackupManager.cs +++ b/Ink Canvas/Helpers/AutoBackupManager.cs @@ -1,4 +1,3 @@ -using Ink_Canvas.Helpers; using Newtonsoft.Json; using System; using System.IO; diff --git a/Ink Canvas/Helpers/CameraService.cs b/Ink Canvas/Helpers/CameraService.cs index e0c4c68c..491c9fef 100644 --- a/Ink Canvas/Helpers/CameraService.cs +++ b/Ink Canvas/Helpers/CameraService.cs @@ -31,22 +31,22 @@ namespace Ink_Canvas.Helpers public FilterInfo CurrentCamera { get; private set; } // 新增属性 - public int RotationAngle - { - get => _rotationAngle; - set => _rotationAngle = Math.Max(0, Math.Min(3, value)); + public int RotationAngle + { + get => _rotationAngle; + set => _rotationAngle = Math.Max(0, Math.Min(3, value)); } - - public int ResolutionWidth - { - get => _resolutionWidth; - set => _resolutionWidth = Math.Max(320, Math.Min(1920, value)); + + public int ResolutionWidth + { + get => _resolutionWidth; + set => _resolutionWidth = Math.Max(320, Math.Min(1920, value)); } - - public int ResolutionHeight - { - get => _resolutionHeight; - set => _resolutionHeight = Math.Max(240, Math.Min(1080, value)); + + public int ResolutionHeight + { + get => _resolutionHeight; + set => _resolutionHeight = Math.Max(240, Math.Min(1080, value)); } public CameraService() @@ -75,7 +75,7 @@ namespace Ink_Canvas.Helpers { AvailableCameras.Clear(); var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); - + foreach (FilterInfo device in videoDevices) { AvailableCameras.Add(device); @@ -265,27 +265,27 @@ namespace Ink_Canvas.Helpers { // 释放之前的帧 _currentFrame?.Dispose(); - + // 创建新的位图,避免Clone的问题 var sourceFrame = eventArgs.Frame; - + if (sourceFrame != null) { try { var width = sourceFrame.Width; var height = sourceFrame.Height; - - if (width > 0 && height > 0) - { - // 应用旋转 - Bitmap rotatedFrame = ApplyRotation(sourceFrame); - - // 应用分辨率调整 - _currentFrame = ResizeImage(rotatedFrame, _resolutionWidth, _resolutionHeight); - - rotatedFrame?.Dispose(); - } + + if (width > 0 && height > 0) + { + // 应用旋转 + Bitmap rotatedFrame = ApplyRotation(sourceFrame); + + // 应用分辨率调整 + _currentFrame = ResizeImage(rotatedFrame, _resolutionWidth, _resolutionHeight); + + rotatedFrame?.Dispose(); + } else { _currentFrame = null; @@ -379,7 +379,7 @@ namespace Ink_Canvas.Helpers public void Dispose() { StopPreview(); - + lock (_frameLock) { _currentFrame?.Dispose(); diff --git a/Ink Canvas/Helpers/FileAssociationManager.cs b/Ink Canvas/Helpers/FileAssociationManager.cs index 89525e93..4eb2ccaf 100644 --- a/Ink Canvas/Helpers/FileAssociationManager.cs +++ b/Ink Canvas/Helpers/FileAssociationManager.cs @@ -419,7 +419,7 @@ namespace Ink_Canvas.Helpers try { string tempDir = Path.GetTempPath(); - + // 处理文件路径IPC文件 string[] ipcFiles = Directory.GetFiles(tempDir, IpcFilePrefix + "*.tmp"); foreach (string ipcFile in ipcFiles) diff --git a/Ink Canvas/Helpers/FloatingWindowInterceptor.cs b/Ink Canvas/Helpers/FloatingWindowInterceptor.cs index 1e0e9d10..ec745625 100644 --- a/Ink Canvas/Helpers/FloatingWindowInterceptor.cs +++ b/Ink Canvas/Helpers/FloatingWindowInterceptor.cs @@ -242,7 +242,7 @@ namespace Ink_Canvas.Helpers public string Description { get; set; } public InterceptType? ParentType { get; set; } public List ChildTypes { get; set; } = new List(); - + // 新增的精确匹配字段 public bool HasWindowStyle { get; set; } public uint WindowStyle { get; set; } @@ -251,7 +251,7 @@ namespace Ink_Canvas.Helpers public int WindowHeight { get; set; } public bool ExactTitleMatch { get; set; } = false; public bool ExactClassNameMatch { get; set; } = false; - + // 运行时状态字段 public bool foundHwnd { get; set; } = false; public IntPtr outHwnd { get; set; } = IntPtr.Zero; @@ -267,7 +267,7 @@ namespace Ink_Canvas.Helpers private readonly Dispatcher _dispatcher; private bool _isRunning; private bool _disposed; - + // 简化的性能统计 private int _consecutiveEmptyScans = 0; private DateTime _lastSuccessfulScan = DateTime.Now; @@ -466,15 +466,15 @@ namespace Ink_Canvas.Helpers RequiresAdmin = true, Description = "畅言智慧课堂 主栏悬浮窗", ParentType = null, - ChildTypes = new List - { - InterceptType.ChangYanBrushSettings, - InterceptType.ChangYanSwipeClear, - InterceptType.ChangYanInteraction, - InterceptType.ChangYanSubjectApp, - InterceptType.ChangYanControl, - InterceptType.ChangYanCommonTools, - InterceptType.ChangYanSceneToolbar, + ChildTypes = new List + { + InterceptType.ChangYanBrushSettings, + InterceptType.ChangYanSwipeClear, + InterceptType.ChangYanInteraction, + InterceptType.ChangYanSubjectApp, + InterceptType.ChangYanControl, + InterceptType.ChangYanCommonTools, + InterceptType.ChangYanSceneToolbar, InterceptType.ChangYanDrawWindow } }; @@ -713,7 +713,7 @@ namespace Ink_Canvas.Helpers if (_isRunning) return; _isRunning = true; - _scanTimer.Change(0, Math.Max(scanIntervalMs, 2000)); + _scanTimer.Change(0, Math.Max(scanIntervalMs, 2000)); } /// @@ -725,7 +725,7 @@ namespace Ink_Canvas.Helpers _isRunning = false; _scanTimer.Change(Timeout.Infinite, Timeout.Infinite); - + // 恢复所有被拦截的窗口 RestoreAllWindows(); } @@ -774,9 +774,9 @@ namespace Ink_Canvas.Helpers { var parentRule = _interceptRules[rule.ParentType.Value]; // 检查是否还有其他启用的子规则 - bool hasEnabledChildren = parentRule.ChildTypes.Any(childType => + bool hasEnabledChildren = parentRule.ChildTypes.Any(childType => _interceptRules.ContainsKey(childType) && _interceptRules[childType].IsEnabled); - + // 如果没有启用的子规则,则禁用父规则 if (!hasEnabledChildren) { @@ -831,7 +831,7 @@ namespace Ink_Canvas.Helpers { var windowsToRestore = new List(_interceptedWindows.Keys); var restoredCount = 0; - + foreach (var hWnd in windowsToRestore) { if (RestoreWindow(hWnd)) @@ -839,7 +839,7 @@ namespace Ink_Canvas.Helpers restoredCount++; } } - + } /// @@ -864,7 +864,7 @@ namespace Ink_Canvas.Helpers restoredCount++; } } - + } /// @@ -875,22 +875,22 @@ namespace Ink_Canvas.Helpers if (!_interceptedWindows.ContainsKey(hWnd)) return false; var interceptType = _interceptedWindows[hWnd]; - + if (IsWindow(hWnd)) { // 使用多种方法确保窗口恢复显示 ShowWindow(hWnd, SW_RESTORE); ShowWindow(hWnd, SW_SHOW); ShowWindow(hWnd, SW_SHOWNORMAL); - + // 将窗口置于前台并显示 - SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 0, 0, + SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW); - + // 强制将窗口带到前台 BringWindowToTop(hWnd); SetForegroundWindow(hWnd); - + _interceptedWindows.Remove(hWnd); WindowRestored?.Invoke(this, new WindowRestoredEventArgs @@ -916,7 +916,7 @@ namespace Ink_Canvas.Helpers private void CleanupInvalidWindows() { var invalidWindows = new List(); - + foreach (var kvp in _interceptedWindows) { var hWnd = kvp.Key; @@ -940,7 +940,7 @@ namespace Ink_Canvas.Helpers // 简化的扫描逻辑 var interceptedCount = 0; CleanupInvalidWindows(); - + // 重置所有规则的发现状态 foreach (var rule in _interceptRules.Values) { @@ -958,9 +958,9 @@ namespace Ink_Canvas.Helpers { if (rule.IsEnabled && rule.foundHwnd && rule.outHwnd != IntPtr.Zero) { - bool shouldIntercept = !_interceptedWindows.ContainsKey(rule.outHwnd) || + bool shouldIntercept = !_interceptedWindows.ContainsKey(rule.outHwnd) || (_interceptedWindows.ContainsKey(rule.outHwnd) && IsWindowVisible(rule.outHwnd)); - + if (shouldIntercept) { InterceptWindow(rule.outHwnd, rule); @@ -1068,7 +1068,7 @@ namespace Ink_Canvas.Helpers var className = new StringBuilder(256); GetClassName(hWnd, className, className.Capacity); var classNameStr = className.ToString(); - + if (rule.ExactClassNameMatch) { if (!classNameStr.Equals(rule.ClassNamePattern, StringComparison.OrdinalIgnoreCase)) @@ -1087,7 +1087,7 @@ namespace Ink_Canvas.Helpers var windowTitle = new StringBuilder(256); GetWindowText(hWnd, windowTitle, windowTitle.Capacity); var titleStr = windowTitle.ToString(); - + if (rule.ExactTitleMatch) { if (!titleStr.Equals(rule.WindowTitlePattern, StringComparison.OrdinalIgnoreCase)) @@ -1126,7 +1126,7 @@ namespace Ink_Canvas.Helpers var horizontalDPI = GetDeviceCaps(hdc, LOGPIXELSX); var verticalDPI = GetDeviceCaps(hdc, LOGPIXELSY); ReleaseDC(IntPtr.Zero, hdc); - + var scale = (horizontalDPI + verticalDPI) / 2.0f / 96.0f; var scaledWidth = (int)(rule.WindowWidth * scale); var scaledHeight = (int)(rule.WindowHeight * scale); @@ -1164,10 +1164,10 @@ namespace Ink_Canvas.Helpers } return; } - + // 直接隐藏窗口,不发送关闭消息 ShowWindow(hWnd, SW_HIDE); - + // 记录拦截的窗口 _interceptedWindows[hWnd] = rule.Type; diff --git a/Ink Canvas/Helpers/GlobalHotkeyManager.cs b/Ink Canvas/Helpers/GlobalHotkeyManager.cs index 917ee3f8..8df7924d 100644 --- a/Ink Canvas/Helpers/GlobalHotkeyManager.cs +++ b/Ink Canvas/Helpers/GlobalHotkeyManager.cs @@ -6,8 +6,8 @@ using System.IO; using System.Reflection; using System.Text; using System.Windows; -using System.Windows.Input; using System.Windows.Forms; +using System.Windows.Input; namespace Ink_Canvas.Helpers { @@ -21,12 +21,12 @@ namespace Ink_Canvas.Helpers private readonly MainWindow _mainWindow; private bool _isDisposed; private bool _hotkeysShouldBeRegistered = true; // 启动时注册热键 - + // 多屏幕支持相关字段 private Screen _currentScreen; private bool _isMultiScreenMode = false; private bool _enableScreenSpecificHotkeys = true; // 是否启用基于屏幕的热键注册 - + // 智能热键管理相关字段 private bool _isWindowFocused = false; private bool _isMouseOverWindow = false; @@ -42,10 +42,10 @@ namespace Ink_Canvas.Helpers _mainWindow = mainWindow ?? throw new ArgumentNullException(nameof(mainWindow)); _registeredHotkeys = new Dictionary(); _hotkeysShouldBeRegistered = true; // 启动时注册热键 - + // 初始化多屏幕支持 InitializeMultiScreenSupport(); - + // 启动时确保配置文件存在 EnsureConfigFileExists(); } @@ -106,10 +106,10 @@ namespace Ink_Canvas.Helpers }); _registeredHotkeys[hotkeyName] = hotkeyInfo; - + // 记录注册信息 var screenInfo = _isMultiScreenMode ? $" (屏幕: {_currentScreen?.DeviceName})" : ""; - + return true; } catch (Exception ex) @@ -506,7 +506,7 @@ namespace Ink_Canvas.Helpers try { _enableScreenSpecificHotkeys = true; - + // 如果当前在多屏幕环境下,刷新热键注册 if (_isMultiScreenMode) { @@ -527,7 +527,7 @@ namespace Ink_Canvas.Helpers try { _enableScreenSpecificHotkeys = false; - + // 重新注册热键(全局模式) if (_hotkeysShouldBeRegistered) { @@ -599,15 +599,15 @@ namespace Ink_Canvas.Helpers { // 检测是否有多个屏幕 _isMultiScreenMode = ScreenDetectionHelper.HasMultipleScreens(); - + if (_isMultiScreenMode) { // 获取当前窗口所在的屏幕 _currentScreen = ScreenDetectionHelper.GetWindowScreen(_mainWindow); - + // 监听窗口位置变化事件 _mainWindow.LocationChanged += OnWindowLocationChanged; - + // 初始化智能热键管理 InitializeSmartHotkeyManagement(); } @@ -634,16 +634,16 @@ namespace Ink_Canvas.Helpers // 监听窗口焦点事件 _mainWindow.GotFocus += OnWindowGotFocus; _mainWindow.LostFocus += OnWindowLostFocus; - + // 监听鼠标进入/离开事件 _mainWindow.MouseEnter += OnMouseEnterWindow; _mainWindow.MouseLeave += OnMouseLeaveWindow; - + // 初始化鼠标位置监控定时器 _mousePositionTimer = new System.Windows.Threading.DispatcherTimer(); _mousePositionTimer.Interval = TimeSpan.FromMilliseconds(500); // 每500ms检查一次 _mousePositionTimer.Tick += OnMousePositionTimerTick; - + } catch (Exception ex) { @@ -665,7 +665,7 @@ namespace Ink_Canvas.Helpers if (newScreen != null && newScreen != _currentScreen) { _currentScreen = newScreen; - + // 重新注册热键以适应新屏幕 RefreshHotkeysForCurrentScreen(); } @@ -691,7 +691,7 @@ namespace Ink_Canvas.Helpers // 重新注册热键 LoadHotkeysFromSettings(); - + } catch (Exception ex) { @@ -776,12 +776,12 @@ namespace Ink_Canvas.Helpers // 检查鼠标是否在当前窗口所在的屏幕上 var mousePosition = Control.MousePosition; var currentScreen = Screen.FromPoint(mousePosition); - + // 无论屏幕是否变化,都检查热键状态 // 这样可以确保热键状态始终与当前上下文保持一致 bool shouldEnableHotkeys = ShouldEnableHotkeysBasedOnContext(); bool currentlyHasHotkeys = _registeredHotkeys.Count > 0; - + if (shouldEnableHotkeys && !currentlyHasHotkeys) { UpdateHotkeyStateBasedOnContext(); @@ -808,27 +808,19 @@ namespace Ink_Canvas.Helpers return; bool shouldEnableHotkeys = ShouldEnableHotkeysBasedOnContext(); - - if (shouldEnableHotkeys) + bool currentlyHasHotkeys = _registeredHotkeys.Count > 0; + + if (shouldEnableHotkeys && !currentlyHasHotkeys) { - // 如果热键未注册,则注册 - if (_registeredHotkeys.Count == 0) - { - LoadHotkeysFromSettings(); - } + // 需要注册快捷键 + LoadHotkeysFromSettings(); } - else + else if (!shouldEnableHotkeys && currentlyHasHotkeys) { - // 如果热键已注册,则注销(与鼠标模式禁用保持一致) - if (_registeredHotkeys.Count > 0) - { - UnregisterAllHotkeys(); - - // 注意:这里不设置 _hotkeysShouldBeRegistered = false - // 因为我们需要保持热键系统的启用状态,只是暂时注销热键 - // 这样当上下文变化时,热键可以重新注册 - } + // 需要注销快捷键 + UnregisterAllHotkeys(); } + // 如果状态没有变化,则不进行任何操作 } catch (Exception ex) { @@ -871,36 +863,50 @@ namespace Ink_Canvas.Helpers { try { - // 策略1:鼠标在窗口上时启用热键(最高优先级) - if (_isMouseOverWindow) + // 检查当前是否处于鼠标模式 + bool isMouseMode = IsInSelectMode(); + + if (isMouseMode) { - return true; + // 鼠标模式下,根据设置决定是否启用快捷键 + return MainWindow.Settings.Appearance.EnableHotkeysInMouseMode; } - - // 策略2:在多屏幕环境下,检查鼠标是否在当前窗口所在的屏幕上 - if (_isMultiScreenMode) + else { - var mousePosition = Control.MousePosition; - var mouseScreen = Screen.FromPoint(mousePosition); + // 非鼠标模式下,需要检查焦点和屏幕位置 - if (mouseScreen == _currentScreen) + // 策略1:鼠标在窗口上时启用热键(最高优先级) + if (_isMouseOverWindow) { return true; } - else - { - return false; - } - } - // 策略3:单屏幕环境下,窗口有焦点时启用热键 - if (_isWindowFocused) - { + // 策略2:在多屏幕环境下,检查鼠标是否在当前窗口所在的屏幕上 + if (_isMultiScreenMode && _enableScreenSpecificHotkeys) + { + var mousePosition = Control.MousePosition; + var mouseScreen = Screen.FromPoint(mousePosition); + + if (mouseScreen == _currentScreen) + { + return true; + } + else + { + return false; + } + } + + // 策略3:单屏幕环境下,窗口有焦点时启用热键 + if (_isWindowFocused) + { + return true; + } + + // 策略4:如果以上都不满足,但在非鼠标模式下,仍然启用快捷键 + // 这样可以确保在批注模式下快捷键始终可用 return true; } - - // 默认情况:禁用热键 - return false; } catch (Exception ex) { @@ -1344,14 +1350,14 @@ namespace Ink_Canvas.Helpers { // 注销所有快捷键 UnregisterAllHotkeys(); - + // 停止定时器 if (_mousePositionTimer != null) { _mousePositionTimer.Stop(); _mousePositionTimer = null; } - + // 移除事件监听器 if (_mainWindow != null) { @@ -1359,7 +1365,7 @@ namespace Ink_Canvas.Helpers { _mainWindow.LocationChanged -= OnWindowLocationChanged; } - + _mainWindow.GotFocus -= OnWindowGotFocus; _mainWindow.LostFocus -= OnWindowLostFocus; _mainWindow.MouseEnter -= OnMouseEnterWindow; diff --git a/Ink Canvas/Helpers/InkSmoothingConfig.cs b/Ink Canvas/Helpers/InkSmoothingConfig.cs index c1af933d..06bc2b0f 100644 --- a/Ink Canvas/Helpers/InkSmoothingConfig.cs +++ b/Ink Canvas/Helpers/InkSmoothingConfig.cs @@ -77,40 +77,40 @@ namespace Ink_Canvas.Helpers { // 保存用户设置的异步处理偏好 bool userAsyncPreference = UseAsyncProcessing; - + switch (Quality) { case SmoothingQuality.Performance: - SmoothingStrength = 0.15; - ResampleInterval = 5.0; - InterpolationSteps = 4; + SmoothingStrength = 0.15; + ResampleInterval = 5.0; + InterpolationSteps = 4; UseAdaptiveInterpolation = false; - CurveTension = 0.15; + CurveTension = 0.15; MaxConcurrentTasks = Math.Max(1, Environment.ProcessorCount / 2); - UseHardwareAcceleration = true; - UseAsyncProcessing = userAsyncPreference; + UseHardwareAcceleration = true; + UseAsyncProcessing = userAsyncPreference; break; case SmoothingQuality.Balanced: - SmoothingStrength = 0.3; - ResampleInterval = 3.0; - InterpolationSteps = 8; + SmoothingStrength = 0.3; + ResampleInterval = 3.0; + InterpolationSteps = 8; UseAdaptiveInterpolation = true; - CurveTension = 0.25; + CurveTension = 0.25; MaxConcurrentTasks = Environment.ProcessorCount; UseHardwareAcceleration = true; - UseAsyncProcessing = userAsyncPreference; + UseAsyncProcessing = userAsyncPreference; break; case SmoothingQuality.Quality: - SmoothingStrength = 0.5; - ResampleInterval = 2.0; - InterpolationSteps = 15; + SmoothingStrength = 0.5; + ResampleInterval = 2.0; + InterpolationSteps = 15; UseAdaptiveInterpolation = true; - CurveTension = 0.35; + CurveTension = 0.35; MaxConcurrentTasks = Environment.ProcessorCount; UseHardwareAcceleration = true; - UseAsyncProcessing = userAsyncPreference; + UseAsyncProcessing = userAsyncPreference; break; } } diff --git a/Ink Canvas/Helpers/MultiPPTInkManager.cs b/Ink Canvas/Helpers/MultiPPTInkManager.cs index ec491824..02d70da2 100644 --- a/Ink Canvas/Helpers/MultiPPTInkManager.cs +++ b/Ink Canvas/Helpers/MultiPPTInkManager.cs @@ -26,7 +26,7 @@ namespace Ink_Canvas.Helpers private readonly object _lockObject = new object(); private bool _disposed; private string _currentActivePresentationId = ""; - + // 墨迹备份机制 private readonly Dictionary> _strokeBackups; private DateTime _lastBackupTime = DateTime.MinValue; @@ -55,7 +55,7 @@ namespace Ink_Canvas.Helpers try { var presentationId = GeneratePresentationId(presentation); - + // 如果已存在该演示文稿的管理器,先清理 if (_presentationManagers.ContainsKey(presentationId)) { @@ -104,11 +104,11 @@ namespace Ink_Canvas.Helpers try { var presentationId = GeneratePresentationId(presentation); - + if (_presentationManagers.ContainsKey(presentationId)) { // 如果切换的是不同的演示文稿,先保存当前活跃演示文稿的墨迹 - if (!string.IsNullOrEmpty(_currentActivePresentationId) && + if (!string.IsNullOrEmpty(_currentActivePresentationId) && _currentActivePresentationId != presentationId) { var currentManager = GetCurrentManager(); @@ -132,7 +132,7 @@ namespace Ink_Canvas.Helpers } _currentActivePresentationId = presentationId; - + // 更新最后访问时间 if (_presentationInfos.ContainsKey(presentationId)) { @@ -176,13 +176,13 @@ namespace Ink_Canvas.Helpers { // 保存到管理器 manager.SaveCurrentSlideStrokes(slideIndex, strokes); - + // 只有在保存成功后才创建备份 if (!string.IsNullOrEmpty(_currentActivePresentationId)) { CreateStrokeBackup(_currentActivePresentationId, slideIndex, strokes); } - + // 检查是否需要执行定期备份 CheckAndPerformBackup(); } @@ -233,7 +233,7 @@ namespace Ink_Canvas.Helpers if (manager != null) { var strokes = manager.LoadSlideStrokes(slideIndex); - + // 如果从管理器加载失败,尝试从备份恢复 if (strokes == null || strokes.Count == 0) { @@ -242,14 +242,14 @@ namespace Ink_Canvas.Helpers strokes = RestoreStrokeFromBackup(_currentActivePresentationId, slideIndex); } } - + return strokes ?? new StrokeCollection(); } } catch (Exception ex) { LogHelper.WriteLogToFile($"加载页面墨迹失败: {ex}", LogHelper.LogType.Error); - + // 尝试从备份恢复 if (!string.IsNullOrEmpty(_currentActivePresentationId)) { @@ -464,12 +464,12 @@ namespace Ink_Canvas.Helpers try { var presentationId = GeneratePresentationId(presentation); - + if (_presentationManagers.ContainsKey(presentationId)) { // 保存墨迹到文件 _presentationManagers[presentationId].SaveAllStrokesToFile(presentation); - + // 释放资源 _presentationManagers[presentationId].Dispose(); _presentationManagers.Remove(presentationId); @@ -550,13 +550,13 @@ namespace Ink_Canvas.Helpers _presentationManagers.Remove(id); } _presentationInfos.Remove(id); - + // 清理备份数据 if (_strokeBackups.ContainsKey(id)) { _strokeBackups.Remove(id); } - + LogHelper.WriteLogToFile($"已清理非活跃演示文稿: {id}", LogHelper.LogType.Trace); } } @@ -589,7 +589,7 @@ namespace Ink_Canvas.Helpers // 创建新的备份 _strokeBackups[presentationId][slideIndex] = strokes.Clone(); - + } catch (Exception ex) { @@ -604,7 +604,7 @@ namespace Ink_Canvas.Helpers { try { - if (_strokeBackups.ContainsKey(presentationId) && + if (_strokeBackups.ContainsKey(presentationId) && _strokeBackups[presentationId].ContainsKey(slideIndex)) { var backup = _strokeBackups[presentationId][slideIndex]; @@ -631,7 +631,7 @@ namespace Ink_Canvas.Helpers try { var now = DateTime.Now; - + // 检查是否需要执行备份 if (now - _lastBackupTime < TimeSpan.FromMinutes(BackupIntervalMinutes)) { @@ -639,7 +639,7 @@ namespace Ink_Canvas.Helpers } // 备份当前活跃演示文稿的所有墨迹 - if (!string.IsNullOrEmpty(_currentActivePresentationId) && + if (!string.IsNullOrEmpty(_currentActivePresentationId) && _presentationManagers.ContainsKey(_currentActivePresentationId)) { var manager = _presentationManagers[_currentActivePresentationId]; @@ -661,7 +661,7 @@ namespace Ink_Canvas.Helpers #region Private Methods private PPTInkManager GetCurrentManager() { - if (string.IsNullOrEmpty(_currentActivePresentationId) || + if (string.IsNullOrEmpty(_currentActivePresentationId) || !_presentationManagers.ContainsKey(_currentActivePresentationId)) { return null; @@ -780,7 +780,7 @@ namespace Ink_Canvas.Helpers } _presentationManagers.Clear(); _presentationInfos.Clear(); - + // 清理备份数据 foreach (var backupDict in _strokeBackups.Values) { diff --git a/Ink Canvas/Helpers/MultiTouchInput.cs b/Ink Canvas/Helpers/MultiTouchInput.cs index 9764d2ca..33219c5f 100644 --- a/Ink Canvas/Helpers/MultiTouchInput.cs +++ b/Ink Canvas/Helpers/MultiTouchInput.cs @@ -31,7 +31,7 @@ namespace Ink_Canvas.Helpers { private bool _needsRedraw = true; private int _lastPointCount = 0; - private const int REDRAW_THRESHOLD = 3; + private const int REDRAW_THRESHOLD = 3; /// /// 创建显示笔迹的类 @@ -53,7 +53,7 @@ namespace Ink_Canvas.Helpers public StrokeVisual(DrawingAttributes drawingAttributes) { _drawingAttributes = drawingAttributes; - + // 启用硬件加速 RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.HighQuality); RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); @@ -82,7 +82,7 @@ namespace Ink_Canvas.Helpers Stroke.StylusPoints.Add(point); _lastPointCount++; } - + // 标记需要重绘 _needsRedraw = true; } @@ -93,7 +93,7 @@ namespace Ink_Canvas.Helpers public void Redraw() { if (!_needsRedraw || Stroke == null) return; - + if (_lastPointCount % REDRAW_THRESHOLD != 0 && _lastPointCount > REDRAW_THRESHOLD) { return; diff --git a/Ink Canvas/Helpers/PPTInkManager.cs b/Ink Canvas/Helpers/PPTInkManager.cs index 2fee446c..cad06029 100644 --- a/Ink Canvas/Helpers/PPTInkManager.cs +++ b/Ink Canvas/Helpers/PPTInkManager.cs @@ -30,12 +30,12 @@ namespace Ink_Canvas.Helpers private DateTime _inkLockUntil = DateTime.MinValue; private int _lockedSlideIndex = -1; private const int InkLockMilliseconds = 500; - + // 添加快速切换保护机制 private DateTime _lastSwitchTime = DateTime.MinValue; private int _lastSwitchSlideIndex = -1; private const int MinSwitchIntervalMs = 100; // 最小切换间隔100毫秒 - + // 内存管理相关字段 private long _totalMemoryUsage = 0; private const long MaxMemoryUsageBytes = 100 * 1024 * 1024; // 100MB限制 @@ -90,7 +90,7 @@ namespace Ink_Canvas.Helpers { return; } - throw; + throw; } _memoryStreams = new MemoryStream[slideCount + 2]; @@ -238,7 +238,7 @@ namespace Ink_Canvas.Helpers { // 检查快速切换保护 var now = DateTime.Now; - if (now - _lastSwitchTime < TimeSpan.FromMilliseconds(MinSwitchIntervalMs) && + if (now - _lastSwitchTime < TimeSpan.FromMilliseconds(MinSwitchIntervalMs) && _lastSwitchSlideIndex == slideIndex) { LogHelper.WriteLogToFile($"快速切换保护:忽略重复的页面切换请求 {slideIndex}", LogHelper.LogType.Warning); @@ -251,11 +251,11 @@ namespace Ink_Canvas.Helpers // 加载新页面的墨迹 var newStrokes = LoadSlideStrokes(slideIndex); - + // 更新切换记录 _lastSwitchTime = now; _lastSwitchSlideIndex = slideIndex; - + if (newStrokes.Count > 0) { } @@ -300,7 +300,7 @@ namespace Ink_Canvas.Helpers // 保存所有页面的墨迹 int savedCount = 0; int slideCount = 0; - + try { slideCount = presentation.Slides.Count; @@ -308,13 +308,13 @@ namespace Ink_Canvas.Helpers catch (COMException comEx) { var hr = (uint)comEx.HResult; - if (hr == 0x80048010) + if (hr == 0x80048010) { return; } - throw; + throw; } - + for (int i = 1; i <= slideCount && i < _memoryStreams.Length; i++) { if (_memoryStreams[i] != null) @@ -430,7 +430,7 @@ namespace Ink_Canvas.Helpers _memoryStreams[i] = null; } } - + // 重新初始化数组 _memoryStreams = new MemoryStream[_maxSlides + 2]; } @@ -464,20 +464,20 @@ namespace Ink_Canvas.Helpers { return true; } - + // 如果当前页面与锁定页面相同,允许写入(用户在当前页面绘制) if (currentSlideIndex == _lockedSlideIndex) { return true; } - + // 如果当前页面不是锁定页面,但锁定时间很短(小于50ms),允许写入 // 这样可以确保旧页面的墨迹能够及时保存 if (DateTime.Now - (_inkLockUntil.AddMilliseconds(-InkLockMilliseconds)) < TimeSpan.FromMilliseconds(50)) { return true; } - + // 只有在快速切换且页面不同时才锁定 return false; } @@ -504,7 +504,7 @@ namespace Ink_Canvas.Helpers try { var now = DateTime.Now; - + // 检查是否需要执行内存清理 if (now - _lastMemoryCleanup < TimeSpan.FromMinutes(MemoryCleanupIntervalMinutes)) { @@ -530,10 +530,10 @@ namespace Ink_Canvas.Helpers if (currentMemoryUsage > MaxMemoryUsageBytes) { LogHelper.WriteLogToFile($"内存使用量超限 ({currentMemoryUsage / 1024 / 1024}MB),开始清理", LogHelper.LogType.Warning); - + // 清理非当前页面的墨迹 CleanupInactiveSlideStrokes(); - + _lastMemoryCleanup = now; LogHelper.WriteLogToFile($"内存清理完成,当前使用量: {_totalMemoryUsage / 1024 / 1024}MB", LogHelper.LogType.Trace); } @@ -571,7 +571,7 @@ namespace Ink_Canvas.Helpers if (_memoryStreams[i] != null) { long memorySize = _memoryStreams[i].Length; - + try { _memoryStreams[i].Dispose(); diff --git a/Ink Canvas/Helpers/PPTUIManager.cs b/Ink Canvas/Helpers/PPTUIManager.cs index dc5c2b86..1c65e9ef 100644 --- a/Ink Canvas/Helpers/PPTUIManager.cs +++ b/Ink Canvas/Helpers/PPTUIManager.cs @@ -104,8 +104,8 @@ namespace Ink_Canvas.Helpers _dispatcher.BeginInvoke(new Action(() => { MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle, 0, 0, - System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, - System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); }), DispatcherPriority.ApplicationIdle); } } @@ -118,12 +118,12 @@ namespace Ink_Canvas.Helpers { // 恢复为非画板模式,重新启用全屏限制 AvoidFullScreenHelper.SetBoardMode(false); - + _dispatcher.BeginInvoke(new Action(() => { // 退出PPT放映模式,恢复到工作区域大小 var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; - MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle, + MainWindow.MoveWindow(new WindowInteropHelper(_mainWindow).Handle, workingArea.X, workingArea.Y, workingArea.Width, workingArea.Height, true); }), DispatcherPriority.ApplicationIdle); diff --git a/Ink Canvas/Helpers/ScreenDetectionHelper.cs b/Ink Canvas/Helpers/ScreenDetectionHelper.cs index 5d048a7f..52c0c477 100644 --- a/Ink Canvas/Helpers/ScreenDetectionHelper.cs +++ b/Ink Canvas/Helpers/ScreenDetectionHelper.cs @@ -31,7 +31,7 @@ namespace Ink_Canvas.Helpers // 获取窗口在屏幕上的位置 var windowRect = GetWindowScreenBounds(window); - + // 查找与窗口重叠最多的屏幕 Screen targetScreen = null; double maxIntersection = 0; @@ -66,10 +66,10 @@ namespace Ink_Canvas.Helpers { // 获取窗口左上角在屏幕上的位置 var topLeft = window.PointToScreen(new Point(0, 0)); - + // 获取窗口右下角在屏幕上的位置 var bottomRight = window.PointToScreen(new Point(window.ActualWidth, window.ActualHeight)); - + return new Rectangle( (int)topLeft.X, (int)topLeft.Y, diff --git a/Ink Canvas/InkCanvasForClass.csproj b/Ink Canvas/InkCanvasForClass.csproj index 6c8c692b..24d06117 100644 --- a/Ink Canvas/InkCanvasForClass.csproj +++ b/Ink Canvas/InkCanvasForClass.csproj @@ -225,6 +225,8 @@ + + @@ -290,7 +292,9 @@ + + @@ -325,6 +329,7 @@ + @@ -342,9 +347,6 @@ - - - @@ -459,6 +461,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -504,6 +537,10 @@ + + + + @@ -532,6 +569,8 @@ + + @@ -587,6 +626,12 @@ + + + + + + diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 6c089f0f..d7958e35 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -189,12 +189,18 @@ /// 保存画布上的非笔画元素(如图片、媒体元素等) /// @@ -64,13 +64,13 @@ namespace Ink_Canvas if (originalElement is Image originalImage) { var clonedImage = new Image(); - + // 复制图片源 if (originalImage.Source is BitmapSource bitmapSource) { clonedImage.Source = bitmapSource; } - + // 复制属性 clonedImage.Width = originalImage.Width; clonedImage.Height = originalImage.Height; @@ -81,23 +81,23 @@ namespace Ink_Canvas clonedImage.Focusable = originalImage.Focusable; clonedImage.Cursor = originalImage.Cursor; clonedImage.IsManipulationEnabled = originalImage.IsManipulationEnabled; - + // 复制位置 InkCanvas.SetLeft(clonedImage, InkCanvas.GetLeft(originalImage)); InkCanvas.SetTop(clonedImage, InkCanvas.GetTop(originalImage)); - + // 复制变换 if (originalImage.RenderTransform != null) { clonedImage.RenderTransform = originalImage.RenderTransform.Clone(); } - + return clonedImage; } else if (originalElement is MediaElement originalMedia) { var clonedMedia = new MediaElement(); - + // 复制媒体属性 clonedMedia.Source = originalMedia.Source; clonedMedia.Width = originalMedia.Width; @@ -105,23 +105,23 @@ namespace Ink_Canvas clonedMedia.Name = originalMedia.Name; clonedMedia.IsHitTestVisible = originalMedia.IsHitTestVisible; clonedMedia.Focusable = originalMedia.Focusable; - + // 复制位置 InkCanvas.SetLeft(clonedMedia, InkCanvas.GetLeft(originalMedia)); InkCanvas.SetTop(clonedMedia, InkCanvas.GetTop(originalMedia)); - + // 复制变换 if (originalMedia.RenderTransform != null) { clonedMedia.RenderTransform = originalMedia.RenderTransform.Clone(); } - + return clonedMedia; } else if (originalElement is Border originalBorder) { var clonedBorder = new Border(); - + // 复制边框属性 clonedBorder.Width = originalBorder.Width; clonedBorder.Height = originalBorder.Height; @@ -132,17 +132,17 @@ namespace Ink_Canvas clonedBorder.BorderBrush = originalBorder.BorderBrush; clonedBorder.BorderThickness = originalBorder.BorderThickness; clonedBorder.CornerRadius = originalBorder.CornerRadius; - + // 复制位置 InkCanvas.SetLeft(clonedBorder, InkCanvas.GetLeft(originalBorder)); InkCanvas.SetTop(clonedBorder, InkCanvas.GetTop(originalBorder)); - + // 复制变换 if (originalBorder.RenderTransform != null) { clonedBorder.RenderTransform = originalBorder.RenderTransform.Clone(); } - + return clonedBorder; } } @@ -150,7 +150,7 @@ namespace Ink_Canvas { LogHelper.WriteLogToFile($"克隆UI元素失败: {ex.Message}", LogHelper.LogType.Error); } - + return null; } @@ -246,14 +246,14 @@ namespace Ink_Canvas if (drawingShapeMode != 0) { inkCanvas.EditingMode = InkCanvasEditingMode.None; - + isTouchDown = true; ViewboxFloatingBar.IsHitTestVisible = false; BlackboardUIGridForInkReplay.IsHitTestVisible = false; - + // 设置起始点 if (NeedUpdateIniP()) iniP = e.GetTouchPoint(inkCanvas).Position; - + return; } @@ -292,14 +292,14 @@ namespace Ink_Canvas if (drawingShapeMode != 0) { inkCanvas.EditingMode = InkCanvasEditingMode.None; - + isTouchDown = true; ViewboxFloatingBar.IsHitTestVisible = false; BlackboardUIGridForInkReplay.IsHitTestVisible = false; - + // 设置起始点 if (NeedUpdateIniP()) iniP = e.GetPosition(inkCanvas); - + return; } if (inkCanvas.EditingMode != InkCanvasEditingMode.EraseByStroke) @@ -354,7 +354,7 @@ namespace Ink_Canvas isTouchDown = false; ViewboxFloatingBar.IsHitTestVisible = true; BlackboardUIGridForInkReplay.IsHitTestVisible = true; - + // 对于双曲线等需要多步绘制的图形,手写笔抬起时应该进入下一步 if (drawingShapeMode == 24 || drawingShapeMode == 25) { @@ -384,7 +384,7 @@ namespace Ink_Canvas }; inkCanvas_MouseUp(inkCanvas, mouseArgs); } - + return; } @@ -393,7 +393,7 @@ namespace Ink_Canvas var stroke = GetStrokeVisual(e.StylusDevice.Id).Stroke; inkCanvas.Strokes.Add(stroke); - await Task.Delay(5); + await Task.Delay(5); inkCanvas.Children.Remove(GetVisualCanvas(e.StylusDevice.Id)); inkCanvas_StrokeCollected(inkCanvas, @@ -464,7 +464,7 @@ namespace Ink_Canvas var strokeVisual = GetStrokeVisual(e.StylusDevice.Id); var stylusPointCollection = e.GetStylusPoints(this); foreach (var stylusPoint in stylusPointCollection) - strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor)); + strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor)); strokeVisual.Redraw(); } catch { } @@ -538,15 +538,15 @@ namespace Ink_Canvas if (drawingShapeMode != 0) { inkCanvas.EditingMode = InkCanvasEditingMode.None; - + // 设置触摸状态,类似鼠标事件处理 isTouchDown = true; ViewboxFloatingBar.IsHitTestVisible = false; BlackboardUIGridForInkReplay.IsHitTestVisible = false; - + // 设置起始点 if (NeedUpdateIniP()) iniP = e.GetTouchPoint(inkCanvas).Position; - + return; } if (inkCanvas.EditingMode == InkCanvasEditingMode.Ink) @@ -604,7 +604,7 @@ namespace Ink_Canvas inkCanvas.CaptureTouch(e.TouchDevice); ViewboxFloatingBar.IsHitTestVisible = false; BlackboardUIGridForInkReplay.IsHitTestVisible = false; - + isTouchDown = true; if (dec.Count == 0) @@ -646,7 +646,7 @@ namespace Ink_Canvas double boundWidth = GetTouchBoundWidth(e); - if ((Settings.Advanced.TouchMultiplier != 0 || !Settings.Advanced.IsSpecialScreen) + if ((Settings.Advanced.TouchMultiplier != 0 || !Settings.Advanced.IsSpecialScreen) && (boundWidth > BoundsWidth)) { // 根据敏感度调整阈值倍数 @@ -665,10 +665,10 @@ namespace Ink_Canvas break; } - double EraserThresholdValue = Settings.Startup.IsEnableNibMode ? - Settings.Advanced.NibModeBoundsWidthThresholdValue : + double EraserThresholdValue = Settings.Startup.IsEnableNibMode ? + Settings.Advanced.NibModeBoundsWidthThresholdValue : Settings.Advanced.FingerModeBoundsWidthThresholdValue; - + if (boundWidth > BoundsWidth * EraserThresholdValue * thresholdMultiplier) { // 记录当前编辑模式和高光状态 @@ -676,17 +676,17 @@ namespace Ink_Canvas palmEraserLastIsHighlighter = drawingAttributes.IsHighlighter; // 动态调整橡皮大小 - boundWidth *= (Settings.Startup.IsEnableNibMode ? - Settings.Advanced.NibModeBoundsWidthEraserSize : + boundWidth *= (Settings.Startup.IsEnableNibMode ? + Settings.Advanced.NibModeBoundsWidthEraserSize : Settings.Advanced.FingerModeBoundsWidthEraserSize); - - if (Settings.Advanced.IsSpecialScreen) + + if (Settings.Advanced.IsSpecialScreen) boundWidth *= Settings.Advanced.TouchMultiplier; - + inkCanvas.EraserShape = new EllipseStylusShape(boundWidth, boundWidth); inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint; isPalmEraserActive = true; - + // 启用橡皮擦覆盖层显示手掌擦样式 EnableEraserOverlay(); // 更新橡皮擦大小以匹配手掌擦面积 @@ -746,7 +746,7 @@ namespace Ink_Canvas { isMultiTouchTimerActive = true; var remainingTime = MULTI_TOUCH_DELAY_MS - timeSinceLastTouch; - System.Threading.Tasks.Task.Delay((int)remainingTime).ContinueWith(_ => + System.Threading.Tasks.Task.Delay((int)remainingTime).ContinueWith(_ => { Dispatcher.Invoke(() => { @@ -760,7 +760,7 @@ namespace Ink_Canvas } return; } - + lastInkCanvasEditingMode = inkCanvas.EditingMode; if (inkCanvas.EditingMode != InkCanvasEditingMode.EraseByPoint && inkCanvas.EditingMode != InkCanvasEditingMode.EraseByStroke @@ -773,7 +773,7 @@ namespace Ink_Canvas private void inkCanvas_PreviewTouchMove(object sender, TouchEventArgs e) { - + // 如果手掌擦激活,更新橡皮擦反馈位置 if (isPalmEraserActive) { @@ -795,13 +795,13 @@ namespace Ink_Canvas // Palm Eraser 逻辑 dec.Remove(e.TouchDevice.Id); - + // 重置多触控点定时器状态 if (dec.Count <= 1) { isMultiTouchTimerActive = false; } - + // 当手掌擦激活且所有触摸点都抬起时,恢复原编辑模式 if (isPalmEraserActive && dec.Count == 0) @@ -842,7 +842,7 @@ namespace Ink_Canvas // 重置手掌擦状态 isPalmEraserActive = false; - + // 禁用橡皮擦覆盖层 DisableEraserOverlay(); if (Settings.Canvas.IsShowCursor) @@ -859,7 +859,7 @@ namespace Ink_Canvas isTouchDown = false; ViewboxFloatingBar.IsHitTestVisible = true; BlackboardUIGridForInkReplay.IsHitTestVisible = true; - + // 对于双曲线等需要多步绘制的图形,触摸抬手时应该进入下一步 if (drawingShapeMode == 24 || drawingShapeMode == 25) { @@ -917,7 +917,7 @@ namespace Ink_Canvas inkCanvas.EditingMode = lastInkCanvasEditingMode; } - if (isPalmEraserActive) + if (isPalmEraserActive) { LogHelper.WriteLogToFile("Palm eraser force recovery - all touch points cleared"); @@ -1010,7 +1010,7 @@ namespace Ink_Canvas bool disableScale = dec.Count >= 3; if (isInMultiTouchMode) return; - + if (dec.Count == 0 && (isSingleFingerDragMode || isInMultiTouchMode)) { ResetTouchStates(); @@ -1113,7 +1113,7 @@ namespace Ink_Canvas else { foreach (var stroke in inkCanvas.Strokes) stroke.Transform(m, false); - + // 同时变换画布上的图片元素 TransformCanvasImages(m); } @@ -1144,7 +1144,7 @@ namespace Ink_Canvas for (int i = inkCanvas.Children.Count - 1; i >= 0; i--) { var child = inkCanvas.Children[i]; - + if (child is Image image) { // 应用矩阵变换到图片 diff --git a/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs b/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs index 678f8232..2b64622b 100644 --- a/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs +++ b/Ink Canvas/MainWindow_cs/MW_TrayIcon.cs @@ -209,15 +209,15 @@ namespace Ink_Canvas try { // 获取全局快捷键管理器 - var hotkeyManagerField = typeof(MainWindow).GetField("_globalHotkeyManager", + var hotkeyManagerField = typeof(MainWindow).GetField("_globalHotkeyManager", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); var hotkeyManager = hotkeyManagerField?.GetValue(mainWin) as GlobalHotkeyManager; - + if (hotkeyManager != null) { // 禁用所有快捷键 hotkeyManager.DisableHotkeyRegistration(); - + // 更新菜单项文本和状态 var menuItem = sender as MenuItem; if (menuItem != null) diff --git a/Ink Canvas/Properties/AssemblyInfo.cs b/Ink Canvas/Properties/AssemblyInfo.cs index 16ecbd01..567d00bd 100644 --- a/Ink Canvas/Properties/AssemblyInfo.cs +++ b/Ink Canvas/Properties/AssemblyInfo.cs @@ -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.12.0")] -[assembly: AssemblyFileVersion("1.7.12.0")] +[assembly: AssemblyVersion("1.7.13.0")] +[assembly: AssemblyFileVersion("1.7.13.0")] diff --git a/Ink Canvas/Resources/GeometryIcons.xaml b/Ink Canvas/Resources/GeometryIcons.xaml index 919eb517..be5508c3 100644 --- a/Ink Canvas/Resources/GeometryIcons.xaml +++ b/Ink Canvas/Resources/GeometryIcons.xaml @@ -1,100 +1,100 @@  - + - + - - + + - - + + - - + + - - - - - - - - - - + + + + + + + + + + - - - + + + - + - + - - - - + + + + - - - + + + - - + + diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_add_circle_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_add_circle_24_regular_white.png new file mode 100644 index 00000000..09efb284 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_add_circle_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_circle_left_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_circle_left_24_regular_white.png new file mode 100644 index 00000000..3e88c44a Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_circle_left_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_circle_right_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_circle_right_24_regular_white.png new file mode 100644 index 00000000..cc737d74 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_circle_right_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_clockwise_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_clockwise_24_regular_white.png new file mode 100644 index 00000000..f6383e83 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_clockwise_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_rotate_clockwise_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_rotate_clockwise_24_regular_white.png new file mode 100644 index 00000000..cdf34c24 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_arrow_rotate_clockwise_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_book_question_mark_24_regular.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_book_question_mark_24_regular.png deleted file mode 100644 index 1e81d1f8..00000000 Binary files a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_book_question_mark_24_regular.png and /dev/null differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_calendar_sync_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_calendar_sync_24_regular_white.png new file mode 100644 index 00000000..57cc8453 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_calendar_sync_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_camera_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_camera_24_regular_white.png new file mode 100644 index 00000000..2d2b9791 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_camera_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_clock_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_clock_24_regular_white.png new file mode 100644 index 00000000..9246725f Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_clock_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_control_button_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_control_button_24_regular_white.png new file mode 100644 index 00000000..652baf5c Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_control_button_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_copy_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_copy_24_regular_white.png new file mode 100644 index 00000000..454a2b48 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_copy_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular_white.png new file mode 100644 index 00000000..9bc9fb59 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_cursorWITHdelete_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_cursorWITHdelete_24_regular_white.png new file mode 100644 index 00000000..bfd41209 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_cursorWITHdelete_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_cursor_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_cursor_24_regular_white.png new file mode 100644 index 00000000..e635a974 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_cursor_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dark_theme_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dark_theme_24_regular_white.png new file mode 100644 index 00000000..31fb9005 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dark_theme_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_delete_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_delete_24_regular_white.png new file mode 100644 index 00000000..3ab5a9b6 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_delete_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dismiss_circle_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dismiss_circle_24_regular_white.png new file mode 100644 index 00000000..fbac73f5 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dismiss_circle_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_drag_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_drag_24_regular_white.png new file mode 100644 index 00000000..5116fc4f Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_drag_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dual_screen_span_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dual_screen_span_24_regular_white.png new file mode 100644 index 00000000..d8ebfe7d Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_dual_screen_span_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_edit_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_edit_24_regular_white.png new file mode 100644 index 00000000..b9825dc3 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_edit_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_flip_horizontal_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_flip_horizontal_24_regular_white.png new file mode 100644 index 00000000..d0b88c45 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_flip_horizontal_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_flip_vertical_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_flip_vertical_24_regular_white.png new file mode 100644 index 00000000..f47f698f Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_flip_vertical_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_folder_open_24_regular_white (2).png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_folder_open_24_regular_white (2).png new file mode 100644 index 00000000..c30d506b Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_folder_open_24_regular_white (2).png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_keyboard_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_keyboard_24_regular_white.png new file mode 100644 index 00000000..ea935c64 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_keyboard_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_lasso_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_lasso_24_regular_white.png new file mode 100644 index 00000000..680809e7 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_lasso_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_24_regular_white.png new file mode 100644 index 00000000..b9142524 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_money_24_regular-light.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_money_24_regular-light.png index a4bdd0e7..1d326971 100644 Binary files a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_money_24_regular-light.png and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_people_money_24_regular-light.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_person_money_24_regular-light.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_person_money_24_regular-light.png index 62770437..3b99fa87 100644 Binary files a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_person_money_24_regular-light.png and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_person_money_24_regular-light.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_power_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_power_24_regular_white.png new file mode 100644 index 00000000..790be70a Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_power_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_save_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_save_24_regular_white.png new file mode 100644 index 00000000..97c82ad4 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_save_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular_white.png new file mode 100644 index 00000000..90d83968 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_scales_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_scales_24_regular_white.png new file mode 100644 index 00000000..4df375f4 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_scales_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_settings_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_settings_24_regular_white.png new file mode 100644 index 00000000..33f15ba2 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_settings_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_shapes_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_shapes_24_regular_white.png new file mode 100644 index 00000000..945f62ea Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_shapes_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_signature_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_signature_24_regular_white.png new file mode 100644 index 00000000..02de3e36 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_signature_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_timer_24_regular-light.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_timer_24_regular-light.png index 36de1802..8327302d 100644 Binary files a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_timer_24_regular-light.png and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_timer_24_regular-light.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_weather_moon_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_weather_moon_24_regular_white.png new file mode 100644 index 00000000..709edd70 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_weather_moon_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_weather_sunny_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_weather_sunny_24_regular_white.png new file mode 100644 index 00000000..eef3edda Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_weather_sunny_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-Fluent/ic_fluent_whiteboard_24_regular_white.png b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_whiteboard_24_regular_white.png new file mode 100644 index 00000000..0bb335d1 Binary files /dev/null and b/Ink Canvas/Resources/Icons-Fluent/ic_fluent_whiteboard_24_regular_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/arrow_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/arrow_white.png new file mode 100644 index 00000000..fe543c63 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/arrow_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/centered-circle-dashed_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/centered-circle-dashed_white.png new file mode 100644 index 00000000..61c9e76f Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/centered-circle-dashed_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/centered-circle_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/centered-circle_white.png new file mode 100644 index 00000000..48ad499d Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/centered-circle_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/centered-oval_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/centered-oval_white.png new file mode 100644 index 00000000..93f3a72e Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/centered-oval_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/centered-square_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/centered-square_white.png new file mode 100644 index 00000000..850c032d Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/centered-square_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/cone_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/cone_white.png new file mode 100644 index 00000000..26ab8818 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/cone_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/cube_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/cube_white.png new file mode 100644 index 00000000..68aba97a Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/cube_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/cylinder_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/cylinder_white.png new file mode 100644 index 00000000..e56b2d60 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/cylinder_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/dashed-line_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/dashed-line_white.png new file mode 100644 index 00000000..3604c7bd Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/dashed-line_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/dotted-line_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/dotted-line_white.png new file mode 100644 index 00000000..6891ac09 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/dotted-line_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/line_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/line_white.png new file mode 100644 index 00000000..9458e110 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/line_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/paralle-lines_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/paralle-lines_white.png new file mode 100644 index 00000000..587af434 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/paralle-lines_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/geo-icons/square_white.png b/Ink Canvas/Resources/Icons-png/geo-icons/square_white.png new file mode 100644 index 00000000..13433b49 Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/geo-icons/square_white.png differ diff --git a/Ink Canvas/Resources/Icons-png/icc-dark.png b/Ink Canvas/Resources/Icons-png/icc-dark.png index d682ec8c..c76d2373 100644 Binary files a/Ink Canvas/Resources/Icons-png/icc-dark.png and b/Ink Canvas/Resources/Icons-png/icc-dark.png differ diff --git a/Ink Canvas/Resources/Icons-png/icc-sharpdark.png b/Ink Canvas/Resources/Icons-png/icc-sharpdark.png new file mode 100644 index 00000000..4880795d Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/icc-sharpdark.png differ diff --git a/Ink Canvas/Resources/Icons-png/icc-transparent-light-small.png b/Ink Canvas/Resources/Icons-png/icc-transparent-light-small.png new file mode 100644 index 00000000..4e58fffc Binary files /dev/null and b/Ink Canvas/Resources/Icons-png/icc-transparent-light-small.png differ diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs index 73cd49ed..67838de3 100644 --- a/Ink Canvas/Resources/Settings.cs +++ b/Ink Canvas/Resources/Settings.cs @@ -101,7 +101,7 @@ namespace Ink_Canvas // 墨迹渐隐功能设置 [JsonProperty("enableInkFade")] - public bool EnableInkFade { get; set; } = false; + public bool EnableInkFade { get; set; } = false; [JsonProperty("inkFadeTime")] public int InkFadeTime { get; set; } = 3000; // 墨迹渐隐时间(毫秒) @@ -233,16 +233,12 @@ namespace Ink_Canvas public bool IsShowLassoSelectButton { get; set; } = true; [JsonProperty("isShowClearAndMouseButton")] public bool IsShowClearAndMouseButton { get; set; } = true; - [JsonProperty("eraserDisplayOption")] public int EraserDisplayOption { get; set; } - [JsonProperty("isShowQuickColorPalette")] public bool IsShowQuickColorPalette { get; set; } - [JsonProperty("quickColorPaletteDisplayMode")] public int QuickColorPaletteDisplayMode { get; set; } = 1; - [JsonProperty("enableHotkeysInMouseMode")] public bool EnableHotkeysInMouseMode { get; set; } = false; @@ -250,8 +246,6 @@ namespace Ink_Canvas public class PowerPointSettings { - // -- new -- - [JsonProperty("showPPTButton")] public bool ShowPPTButton { get; set; } = true; @@ -478,7 +472,7 @@ namespace Ink_Canvas public bool IsEnabled { get; set; } = false; [JsonProperty("scanIntervalMs")] - public int ScanIntervalMs { get; set; } = 5000; + public int ScanIntervalMs { get; set; } = 5000; [JsonProperty("autoStart")] public bool AutoStart { get; set; } = false; @@ -630,13 +624,15 @@ namespace Ink_Canvas [JsonProperty("directCallCiRand")] public bool DirectCallCiRand { get; set; } [JsonProperty("externalCallerType")] - public int ExternalCallerType { get; set; } = 0; + public int ExternalCallerType { get; set; } = 0; [JsonProperty("selectedBackgroundIndex")] public int SelectedBackgroundIndex { get; set; } [JsonProperty("customPickNameBackgrounds")] public List CustomPickNameBackgrounds { get; set; } = new List(); [JsonProperty("useLegacyTimerUI")] public bool UseLegacyTimerUI { get; set; } = false; + [JsonProperty("useSeewoStyleUI")] + public bool UseSeewoStyleUI { get; set; } = false; [JsonProperty("timerVolume")] public double TimerVolume { get; set; } = 1.0; [JsonProperty("customTimerSoundPath")] @@ -688,15 +684,15 @@ namespace Ink_Canvas public class CameraSettings { [JsonProperty("rotationAngle")] - public int RotationAngle { get; set; } = 0; + public int RotationAngle { get; set; } = 0; [JsonProperty("resolutionWidth")] - public int ResolutionWidth { get; set; } = 1920; + public int ResolutionWidth { get; set; } = 1920; [JsonProperty("resolutionHeight")] - public int ResolutionHeight { get; set; } = 1080; + public int ResolutionHeight { get; set; } = 1080; [JsonProperty("selectedCameraIndex")] - public int SelectedCameraIndex { get; set; } = 0; + public int SelectedCameraIndex { get; set; } = 0; } } diff --git a/Ink Canvas/Resources/Styles/Dark.xaml b/Ink Canvas/Resources/Styles/Dark.xaml index 004a6143..68ddd12f 100644 --- a/Ink Canvas/Resources/Styles/Dark.xaml +++ b/Ink Canvas/Resources/Styles/Dark.xaml @@ -1,25 +1,25 @@  - - - - + + + + - #FFcccccc + #FFFFFFFF - - - + + + - + - Transparent - #2200CDCD - #4400CDCD + + + @@ -30,6 +30,11 @@ + + + + + @@ -39,12 +44,99 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ink Canvas/Resources/Styles/Light.xaml b/Ink Canvas/Resources/Styles/Light.xaml index 72389c2c..c3ae721d 100644 --- a/Ink Canvas/Resources/Styles/Light.xaml +++ b/Ink Canvas/Resources/Styles/Light.xaml @@ -14,12 +14,12 @@ - + - Transparent - #66FFFFFF - #99FFFFFF + + + @@ -30,6 +30,11 @@ + + + + + @@ -39,12 +44,99 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ink Canvas/Resources/new-icons/blackboard-light.png b/Ink Canvas/Resources/new-icons/blackboard-light.png index c1bbcde6..7bd8913a 100644 Binary files a/Ink Canvas/Resources/new-icons/blackboard-light.png and b/Ink Canvas/Resources/new-icons/blackboard-light.png differ diff --git a/Ink Canvas/Resources/new-icons/chevron-left-light.png b/Ink Canvas/Resources/new-icons/chevron-left-light.png index b83607dd..efea876d 100644 Binary files a/Ink Canvas/Resources/new-icons/chevron-left-light.png and b/Ink Canvas/Resources/new-icons/chevron-left-light.png differ diff --git a/Ink Canvas/Resources/new-icons/end-slides-show-light.png b/Ink Canvas/Resources/new-icons/end-slides-show-light.png index 2b6f66d1..483ea865 100644 Binary files a/Ink Canvas/Resources/new-icons/end-slides-show-light.png and b/Ink Canvas/Resources/new-icons/end-slides-show-light.png differ diff --git a/Ink Canvas/Resources/new-icons/eye-light.png b/Ink Canvas/Resources/new-icons/eye-light.png index 803da68b..6faac42a 100644 Binary files a/Ink Canvas/Resources/new-icons/eye-light.png and b/Ink Canvas/Resources/new-icons/eye-light.png differ diff --git a/Ink Canvas/Windows/CountdownTimerWindow.xaml b/Ink Canvas/Windows/CountdownTimerWindow.xaml index 0f820a2d..093f416b 100644 --- a/Ink Canvas/Windows/CountdownTimerWindow.xaml +++ b/Ink Canvas/Windows/CountdownTimerWindow.xaml @@ -10,9 +10,9 @@ mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" Loaded="Window_Loaded" Closing="Window_Closing" WindowStartupLocation="CenterScreen" Title="Ink Canvas 画板 - 计时器" Height="700" Width="1100"> - + - + @@ -22,7 +22,7 @@ HorizontalAlignment="Center"> @@ -69,7 +69,7 @@ FontWeight="DemiBold"/> @@ -128,7 +128,7 @@ FontWeight="DemiBold"/> @@ -167,17 +167,17 @@ - - - + + - + @@ -189,12 +189,12 @@ - + - + @@ -210,22 +210,22 @@ + Background="{DynamicResource TimerWindowButtonBackground}" Height="20" Width="20" CornerRadius="100"> - + + Background="{DynamicResource TimerWindowButtonBackground}" Height="20" Width="20" CornerRadius="100"> - + + /// 刷新主题,当主窗口主题切换时调用 + /// + public void RefreshTheme() + { + try + { + // 重新应用主题 + ApplyTheme(); + + // 强制刷新UI + InvalidateVisual(); + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"刷新计时器窗口主题出错: {ex.Message}", LogHelper.LogType.Error); + } + } + private void UpdateButtonTexts() { if (useLegacyUI) @@ -362,12 +458,12 @@ namespace Ink_Canvas HourPlus1Text.Text = "+1"; HourMinus1Text.Text = "-1"; HourMinus5Text.Text = "-5"; - + MinutePlus5Text.Text = "+5"; MinutePlus1Text.Text = "+1"; MinuteMinus1Text.Text = "-1"; MinuteMinus5Text.Text = "-5"; - + SecondPlus5Text.Text = "+5"; SecondPlus1Text.Text = "+1"; SecondMinus1Text.Text = "-1"; @@ -380,12 +476,12 @@ namespace Ink_Canvas HourPlus1Text.Text = "∧"; HourMinus1Text.Text = "∨"; HourMinus5Text.Text = "∨∨"; - + MinutePlus5Text.Text = "∧∧"; MinutePlus1Text.Text = "∧"; MinuteMinus1Text.Text = "∨"; MinuteMinus5Text.Text = "∨∨"; - + SecondPlus5Text.Text = "∧∧"; SecondPlus1Text.Text = "∧"; SecondMinus1Text.Text = "∨"; @@ -399,8 +495,8 @@ namespace Ink_Canvas { double volume = MainWindow.Settings.RandSettings?.TimerVolume ?? 1.0; mediaPlayer.Volume = volume; - - if (!string.IsNullOrEmpty(MainWindow.Settings.RandSettings?.CustomTimerSoundPath) && + + if (!string.IsNullOrEmpty(MainWindow.Settings.RandSettings?.CustomTimerSoundPath) && System.IO.File.Exists(MainWindow.Settings.RandSettings.CustomTimerSoundPath)) { // 播放自定义铃声 @@ -419,7 +515,7 @@ namespace Ink_Canvas } mediaPlayer.Open(new Uri(tempPath)); } - + mediaPlayer.Play(); } catch (Exception ex) diff --git a/Ink Canvas/Windows/HasNewUpdateWindow.xaml.cs b/Ink Canvas/Windows/HasNewUpdateWindow.xaml.cs index 8b04bf1e..9622e2e6 100644 --- a/Ink Canvas/Windows/HasNewUpdateWindow.xaml.cs +++ b/Ink Canvas/Windows/HasNewUpdateWindow.xaml.cs @@ -92,7 +92,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"应用主题时出错: {ex.Message}", LogHelper.LogType.Error); } } - + /// /// 更新为浅色主题颜色 /// @@ -109,7 +109,7 @@ namespace Ink_Canvas Resources["UpdateWindowTextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x1f, 0x29, 0x37)); Resources["UpdateWindowTextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x6b, 0x72, 0x80)); Resources["UpdateWindowCloseButtonBrush"] = new SolidColorBrush(Color.FromRgb(0x66, 0x66, 0x66)); - + // 更新渐变背景 var gradient = new LinearGradientBrush(); gradient.StartPoint = new Point(0, 0); @@ -123,7 +123,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"更新浅色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error); } } - + /// /// 更新为深色主题颜色 /// @@ -140,7 +140,7 @@ namespace Ink_Canvas Resources["UpdateWindowTextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0xf9, 0xfa, 0xfb)); Resources["UpdateWindowTextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x9c, 0xa3, 0xaf)); Resources["UpdateWindowCloseButtonBrush"] = new SolidColorBrush(Color.FromRgb(0x9c, 0xa3, 0xaf)); - + // 更新渐变背景 var gradient = new LinearGradientBrush(); gradient.StartPoint = new Point(0, 0); @@ -154,7 +154,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"更新深色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error); } } - + /// /// 检查系统是否为浅色主题 /// @@ -270,7 +270,7 @@ namespace Ink_Canvas UpdateLaterButton.IsEnabled = false; SkipVersionButton.IsEnabled = false; DownloadProgressPanel.Visibility = Visibility.Visible; - + // 重置进度条 var progressFill = FindName("ProgressFill") as Border; if (progressFill != null) diff --git a/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs b/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs index 1e402565..34d64f47 100644 --- a/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs +++ b/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs @@ -33,12 +33,12 @@ namespace Ink_Canvas { InitializeComponent(); this.channel = channel; - + // 应用当前主题 ApplyCurrentTheme(); - + LoadVersions(); - + // 添加窗口拖动功能 MouseDown += (sender, e) => { @@ -48,7 +48,7 @@ namespace Ink_Canvas } }; } - + /// /// 应用当前主题设置 /// @@ -86,7 +86,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"应用主题时出错: {ex.Message}", LogHelper.LogType.Error); } } - + /// /// 更新为浅色主题颜色 /// @@ -104,7 +104,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"更新浅色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error); } } - + /// /// 更新为深色主题颜色 /// @@ -122,7 +122,7 @@ namespace Ink_Canvas LogHelper.WriteLogToFile($"更新深色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error); } } - + /// /// 检查系统是否为浅色主题 /// diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml b/Ink Canvas/Windows/OperatingGuideWindow.xaml index 67c81734..7a5f99b8 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml @@ -10,7 +10,7 @@ WindowStartupLocation="CenterScreen" Title="Ink Canvas Annotation 使用指南" Height="600" Width="500"> - + - - + - - + - - + - - + - + - + - + - + - + - + - + - + - + @@ -75,22 +75,22 @@ + Background="{DynamicResource OperatingGuideWindowFullscreenButtonBackground}" Height="20" Width="20" CornerRadius="100"> - + + Background="{DynamicResource OperatingGuideWindowCloseButtonBackground}" Height="20" Width="20" CornerRadius="100"> - + diff --git a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs index 61c50f51..39ded587 100644 --- a/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs +++ b/Ink Canvas/Windows/OperatingGuideWindow.xaml.cs @@ -1,6 +1,8 @@ using Ink_Canvas.Helpers; using System.Windows; using System.Windows.Input; +using iNKORE.UI.WPF.Modern; +using System; namespace Ink_Canvas { @@ -43,5 +45,53 @@ namespace Ink_Canvas { e.Handled = true; } + + /// + /// 刷新主题 + /// + public void RefreshTheme() + { + try + { + // 根据当前主题设置窗口主题 + bool isDarkTheme = MainWindow.Settings.Appearance.Theme == 1 || + (MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()); + + if (isDarkTheme) + { + ThemeManager.SetRequestedTheme(this, ElementTheme.Dark); + } + else + { + ThemeManager.SetRequestedTheme(this, ElementTheme.Light); + } + + // 强制刷新UI + InvalidateVisual(); + } + catch (Exception) + { + } + } + + /// + /// 检查系统主题是否为浅色 + /// + private bool IsSystemThemeLight() + { + var light = false; + try + { + var registryKey = Microsoft.Win32.Registry.CurrentUser; + var themeKey = + registryKey.OpenSubKey("software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"); + var keyValue = 0; + if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme"); + if (keyValue == 1) light = true; + } + catch { } + + return light; + } } } \ No newline at end of file diff --git a/Ink Canvas/Windows/RandWindow.xaml b/Ink Canvas/Windows/RandWindow.xaml index f1bada9c..3abef0c0 100644 --- a/Ink Canvas/Windows/RandWindow.xaml +++ b/Ink Canvas/Windows/RandWindow.xaml @@ -5,11 +5,11 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:local="clr-namespace:Ink_Canvas" FontFamily="Microsoft YaHei UI" - ui:ThemeManager.RequestedTheme="Light" Topmost="True" Background="Transparent" + Topmost="True" Background="Transparent" mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" Title="Ink Canvas 抽奖" Height="500" Width="900"> - + @@ -21,14 +21,14 @@ - - + @@ -51,8 +51,8 @@ - - + + @@ -79,49 +79,51 @@ + HorizontalAlignment="Center" Foreground="{DynamicResource RandWindowTextForeground}"/> + HorizontalAlignment="Center" Foreground="{DynamicResource RandWindowTextForeground}"/> + IsReadOnly="True" + Foreground="{DynamicResource RandWindowTextForeground}"> 全都抽 只抽男 只抽女 - + - + + IsEditable="False" IsReadOnly="True" SelectedIndex="0" + Foreground="{DynamicResource RandWindowTextForeground}"> ClassIsland点名 SecRandom点名 NamePicker点名 - + - + - + @@ -129,15 +131,15 @@ - + - + - + diff --git a/Ink Canvas/Windows/RandWindow.xaml.cs b/Ink Canvas/Windows/RandWindow.xaml.cs index f8f568fe..fc16446c 100644 --- a/Ink Canvas/Windows/RandWindow.xaml.cs +++ b/Ink Canvas/Windows/RandWindow.xaml.cs @@ -34,6 +34,9 @@ namespace Ink_Canvas // 加载背景 LoadBackground(settings); + // 应用主题 + ApplyTheme(settings); + // 设置窗口为置顶 Topmost = true; @@ -75,6 +78,65 @@ namespace Ink_Canvas } } + private void ApplyTheme(Settings settings) + { + try + { + if (settings.Appearance.Theme == 0) // 浅色主题 + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light); + } + else if (settings.Appearance.Theme == 1) // 深色主题 + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark); + } + else // 跟随系统主题 + { + bool isSystemLight = IsSystemThemeLight(); + if (isSystemLight) + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light); + } + else + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark); + } + } + + // 根据主题设置窗口背景 + if (settings.RandSettings.SelectedBackgroundIndex <= 0) + { + // 没有自定义背景时,使用主题背景色 + var backgroundBrush = Application.Current.FindResource("RandWindowBackground") as SolidColorBrush; + if (backgroundBrush != null) + { + MainBorder.Background = backgroundBrush; + } + } + } + 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"); + var keyValue = 0; + if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme"); + if (keyValue == 1) light = true; + } + catch { } + + return light; + } + public RandWindow(Settings settings, bool IsAutoClose) { InitializeComponent(); @@ -88,6 +150,9 @@ namespace Ink_Canvas // 加载背景 LoadBackground(settings); + // 应用主题 + ApplyTheme(settings); + // 设置窗口为置顶 Topmost = true; @@ -413,6 +478,25 @@ namespace Ink_Canvas // 这里可以添加必要的清理代码 } + /// + /// 刷新主题,当主窗口主题切换时调用 + /// + public void RefreshTheme() + { + try + { + // 重新应用主题 + ApplyTheme(MainWindow.Settings); + + // 强制刷新UI + InvalidateVisual(); + } + 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); diff --git a/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs b/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs index 551c8bca..48f6df43 100644 --- a/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs +++ b/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs @@ -1,5 +1,7 @@ -using System; +using Ink_Canvas.Helpers; +using System; using System.Collections.Generic; +using System.Drawing; using System.Windows; using System.Windows.Controls; using System.Windows.Forms; @@ -7,15 +9,13 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Shapes; using System.Windows.Threading; -using System.Drawing; -using Ink_Canvas.Helpers; using Brushes = System.Windows.Media.Brushes; using Color = System.Windows.Media.Color; using DrawingRectangle = System.Drawing.Rectangle; -using WpfPoint = System.Windows.Point; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MouseEventArgs = System.Windows.Input.MouseEventArgs; using WpfCanvas = System.Windows.Controls.Canvas; +using WpfPoint = System.Windows.Point; namespace Ink_Canvas { @@ -115,7 +115,7 @@ namespace Ink_Canvas // 初始化摄像头选择下拉框 RefreshCameraComboBox(); - + // 初始化旋转和分辨率显示 InitializeCameraControls(); } @@ -131,7 +131,7 @@ namespace Ink_Canvas { // 更新旋转角度显示 UpdateRotationDisplay(); - + // 设置分辨率下拉框 var currentResolution = $"{_cameraService.ResolutionWidth}x{_cameraService.ResolutionHeight}"; foreach (ComboBoxItem item in ResolutionComboBox.Items) @@ -150,7 +150,7 @@ namespace Ink_Canvas try { CameraSelectionComboBox.Items.Clear(); - + if (_cameraService.HasAvailableCameras()) { var cameraNames = _cameraService.GetCameraNames(); @@ -158,7 +158,7 @@ namespace Ink_Canvas { CameraSelectionComboBox.Items.Add(name); } - + if (cameraNames.Count > 0) { CameraSelectionComboBox.SelectedIndex = 0; @@ -203,7 +203,7 @@ namespace Ink_Canvas CameraPreviewImage.Source = bitmapSource; CameraStatusText.Text = "摄像头已连接"; } - + // 释放临时位图 clonedFrame.Dispose(); } @@ -393,10 +393,10 @@ namespace Ink_Canvas RectangleModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 FreehandModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 CameraModeButton.Background = new SolidColorBrush(Color.FromRgb(107, 114, 128)); // 灰色 - + // 隐藏摄像头预览 CameraPreviewBorder.Visibility = Visibility.Collapsed; - + // 直接执行全屏截图 PerformFullScreenCapture(); } @@ -512,10 +512,10 @@ namespace Ink_Canvas { // 保存BitmapSource而不是Bitmap CameraBitmapSource = bitmapSource; - + // 停止摄像头预览 _cameraService.StopPreview(); - + // 设置结果并关闭窗口 DialogResult = true; Close(); @@ -1164,11 +1164,11 @@ namespace Ink_Canvas { // 获取虚拟屏幕边界 var virtualScreen = SystemInformation.VirtualScreen; - + // 设置全屏截图区域 SelectedArea = new DrawingRectangle(virtualScreen.X, virtualScreen.Y, virtualScreen.Width, virtualScreen.Height); SelectedPath = null; // 全屏截图不需要路径 - + // 直接关闭窗口并返回结果 DialogResult = true; Close(); @@ -1271,8 +1271,8 @@ namespace Ink_Canvas if (!string.IsNullOrEmpty(resolution)) { var parts = resolution.Split(','); - if (parts.Length == 2 && - int.TryParse(parts[0], out int width) && + if (parts.Length == 2 && + int.TryParse(parts[0], out int width) && int.TryParse(parts[1], out int height)) { _cameraService.ResolutionWidth = width; diff --git a/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml new file mode 100644 index 00000000..fd4a0243 --- /dev/null +++ b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs new file mode 100644 index 00000000..e719f753 --- /dev/null +++ b/Ink Canvas/Windows/SeewoStyleTimerWindow.xaml.cs @@ -0,0 +1,434 @@ +using Ink_Canvas.Helpers; +using System; +using System.Media; +using System.Timers; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Media; + +namespace Ink_Canvas +{ + /// + /// 仿希沃风格的倒计时器窗口 + /// + public partial class SeewoStyleTimerWindow : Window + { + public SeewoStyleTimerWindow() + { + InitializeComponent(); + AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25); + + timer.Elapsed += Timer_Elapsed; + timer.Interval = 50; + InitializeUI(); + + // 应用主题 + ApplyTheme(); + } + + + private void Timer_Elapsed(object sender, ElapsedEventArgs e) + { + if (!isTimerRunning || isPaused) + { + timer.Stop(); + return; + } + + TimeSpan timeSpan = DateTime.Now - startTime; + TimeSpan totalTimeSpan = new TimeSpan(hour, minute, second); + TimeSpan leftTimeSpan = totalTimeSpan - timeSpan; + if (leftTimeSpan.Milliseconds > 0) leftTimeSpan += new TimeSpan(0, 0, 1); + + Application.Current.Dispatcher.Invoke(() => + { + Digit1Display.Text = (leftTimeSpan.Hours / 10).ToString(); + Digit2Display.Text = (leftTimeSpan.Hours % 10).ToString(); + Digit3Display.Text = (leftTimeSpan.Minutes / 10).ToString(); + Digit4Display.Text = (leftTimeSpan.Minutes % 10).ToString(); + Digit5Display.Text = (leftTimeSpan.Seconds / 10).ToString(); + Digit6Display.Text = (leftTimeSpan.Seconds % 10).ToString(); + + if (leftTimeSpan.TotalSeconds <= 0) + { + Digit1Display.Text = "0"; + Digit2Display.Text = "0"; + Digit3Display.Text = "0"; + Digit4Display.Text = "0"; + Digit5Display.Text = "0"; + Digit6Display.Text = "0"; + timer.Stop(); + isTimerRunning = false; + StartPauseIcon.Data = Geometry.Parse(PlayIconData); + PlayTimerSound(); + } + }); + } + + SoundPlayer player = new SoundPlayer(); + MediaPlayer mediaPlayer = new MediaPlayer(); + + int hour = 0; + int minute = 5; + int second = 0; + + DateTime startTime = DateTime.Now; + DateTime pauseTime = DateTime.Now; + + bool isTimerRunning = false; + bool isPaused = false; + + Timer timer = new Timer(); + + private void InitializeUI() + { + UpdateDigitDisplays(); + } + + 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); + } + else if (settings.Appearance.Theme == 1) // 深色主题 + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark); + } + else // 跟随系统主题 + { + bool isSystemLight = IsSystemThemeLight(); + if (isSystemLight) + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Light); + } + else + { + iNKORE.UI.WPF.Modern.ThemeManager.SetRequestedTheme(this, iNKORE.UI.WPF.Modern.ElementTheme.Dark); + } + } + } + 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; + } + + private void UpdateDigitDisplays() + { + Digit1Display.Text = (hour / 10).ToString(); + Digit2Display.Text = (hour % 10).ToString(); + Digit3Display.Text = (minute / 10).ToString(); + Digit4Display.Text = (minute % 10).ToString(); + Digit5Display.Text = (second / 10).ToString(); + Digit6Display.Text = (second % 10).ToString(); + } + + // 第1位数字(小时十位) + private void Digit1Plus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + hour += 10; + if (hour >= 100) hour = 0; + UpdateDigitDisplays(); + } + + private void Digit1Minus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + hour -= 10; + if (hour < 0) hour = 90; + UpdateDigitDisplays(); + } + + // 第2位数字(小时个位) + private void Digit2Plus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + hour++; + if (hour >= 100) hour = 0; + UpdateDigitDisplays(); + } + + private void Digit2Minus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + hour--; + if (hour < 0) hour = 99; + UpdateDigitDisplays(); + } + + // 第3位数字(分钟十位) + private void Digit3Plus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + minute += 10; + if (minute >= 60) minute = 0; + UpdateDigitDisplays(); + } + + private void Digit3Minus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + minute -= 10; + if (minute < 0) minute = 50; + UpdateDigitDisplays(); + } + + // 第4位数字(分钟个位) + private void Digit4Plus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + minute++; + if (minute >= 60) minute = 0; + UpdateDigitDisplays(); + } + + private void Digit4Minus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + minute--; + if (minute < 0) minute = 59; + UpdateDigitDisplays(); + } + + // 第5位数字(秒十位) + private void Digit5Plus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + second += 10; + if (second >= 60) second = 0; + UpdateDigitDisplays(); + } + + private void Digit5Minus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + second -= 10; + if (second < 0) second = 50; + UpdateDigitDisplays(); + } + + // 第6位数字(秒个位) + private void Digit6Plus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + second++; + if (second >= 60) second = 0; + UpdateDigitDisplays(); + } + + private void Digit6Minus_Click(object sender, RoutedEventArgs e) + { + if (isTimerRunning) return; + second--; + if (second < 0) second = 59; + UpdateDigitDisplays(); + } + + // 图标数据常量 + private const string PlayIconData = "M6.5 4.00004V20C6.49995 20.178 6.54737 20.3527 6.63738 20.5062C6.72739 20.6597 6.85672 20.7864 7.01202 20.8732C7.16733 20.96 7.34299 21.0038 7.52088 21.0001C7.69878 20.9964 7.87245 20.9453 8.024 20.852L21.024 12.852C21.1696 12.7626 21.2898 12.6373 21.3733 12.4881C21.4567 12.339 21.5005 12.1709 21.5005 12C21.5005 11.8291 21.4567 11.6611 21.3733 11.512C21.2898 11.3628 21.1696 11.2375 21.024 11.148L8.024 3.14804C7.87245 3.0548 7.69878 3.00369 7.52088 2.99997C7.34299 2.99626 7.16733 3.04007 7.01202 3.1269C6.85672 3.21372 6.72739 3.34042 6.63738 3.4939C6.54737 3.64739 6.49995 3.82211 6.5 4.00004Z"; + private const string PauseIconData = "M9.5 4H7.5C6.96957 4 6.46086 4.21071 6.08579 4.58579C5.71071 4.96086 5.5 5.46957 5.5 6V18C5.5 18.5304 5.71071 19.0391 6.08579 19.4142C6.46086 19.7893 6.96957 20 7.5 20H9.5C10.0304 20 10.5391 19.7893 10.9142 19.4142C11.2893 19.0391 11.5 18.5304 11.5 18V6C11.5 5.46957 11.2893 4.96086 10.9142 4.58579C10.5391 4.21071 10.0304 4 9.5 4Z M17.5 4H15.5C14.9696 4 14.4609 4.21071 14.0858 4.58579C13.7107 4.96086 13.5 5.46957 13.5 6V18C13.5 18.5304 13.7107 19.0391 14.0858 19.4142C14.4609 19.7893 14.9696 20 15.5 20H17.5C18.0304 20 18.5391 19.7893 18.9142 19.4142C19.2893 19.0391 19.5 18.5304 19.5 18V6C19.5 5.46957 19.2893 4.96086 18.9142 4.58579C18.5391 4.21071 18.0304 4 17.5 4Z"; + + private void StartPause_Click(object sender, RoutedEventArgs e) + { + if (isPaused && isTimerRunning) + { + // 继续计时 + startTime += DateTime.Now - pauseTime; + StartPauseIcon.Data = Geometry.Parse(PauseIconData); + isPaused = false; + timer.Start(); + } + else if (isTimerRunning) + { + // 暂停计时 + pauseTime = DateTime.Now; + StartPauseIcon.Data = Geometry.Parse(PlayIconData); + isPaused = true; + timer.Stop(); + } + else + { + // 开始计时 + if (hour == 0 && minute == 0 && second == 0) + { + second = 1; + UpdateDigitDisplays(); + } + + startTime = DateTime.Now; + StartPauseIcon.Data = Geometry.Parse(PauseIconData); + isPaused = false; + isTimerRunning = true; + timer.Start(); + } + } + + private void Reset_Click(object sender, RoutedEventArgs e) + { + if (!isTimerRunning) + { + UpdateDigitDisplays(); + } + else if (isTimerRunning && isPaused) + { + UpdateDigitDisplays(); + StartPauseIcon.Data = Geometry.Parse(PlayIconData); + isTimerRunning = false; + timer.Stop(); + isPaused = false; + } + else + { + startTime = DateTime.Now; + Timer_Elapsed(timer, null); + } + } + + private void Fullscreen_Click(object sender, RoutedEventArgs e) + { + if (WindowState == WindowState.Normal) + { + WindowState = WindowState.Maximized; + } + else + { + WindowState = WindowState.Normal; + } + } + + + private void PlayTimerSound() + { + try + { + double volume = MainWindow.Settings.RandSettings?.TimerVolume ?? 1.0; + mediaPlayer.Volume = volume; + + if (!string.IsNullOrEmpty(MainWindow.Settings.RandSettings?.CustomTimerSoundPath) && + System.IO.File.Exists(MainWindow.Settings.RandSettings.CustomTimerSoundPath)) + { + // 播放自定义铃声 + mediaPlayer.Open(new Uri(MainWindow.Settings.RandSettings.CustomTimerSoundPath)); + } + else + { + // 播放默认铃声 + string tempPath = System.IO.Path.GetTempFileName() + ".wav"; + using (var stream = Properties.Resources.TimerDownNotice) + { + using (var fileStream = new System.IO.FileStream(tempPath, System.IO.FileMode.Create)) + { + stream.CopyTo(fileStream); + } + } + mediaPlayer.Open(new Uri(tempPath)); + } + + mediaPlayer.Play(); + } + catch (Exception ex) + { + // 如果播放失败,静默处理 + System.Diagnostics.Debug.WriteLine($"播放计时器铃声失败: {ex.Message}"); + } + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + // 窗口加载时的初始化 + } + + 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 BtnClose_MouseUp(object sender, MouseButtonEventArgs e) + { + Close(); + } + + private void WindowDragMove(object sender, MouseEventArgs e) + { + if (e.LeftButton == MouseButtonState.Pressed) + DragMove(); + } + } +} diff --git a/Ink Canvas/Windows/SplashScreen.xaml.cs b/Ink Canvas/Windows/SplashScreen.xaml.cs index e4e91da7..3d68d5ff 100644 --- a/Ink Canvas/Windows/SplashScreen.xaml.cs +++ b/Ink Canvas/Windows/SplashScreen.xaml.cs @@ -1,13 +1,12 @@ +using Newtonsoft.Json; using System; +using System.IO; using System.Reflection; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Threading; -using System.IO; -using Newtonsoft.Json; namespace Ink_Canvas.Windows { @@ -18,7 +17,7 @@ namespace Ink_Canvas.Windows { private DispatcherTimer _timer; private int _loadingStep = 0; - private int _actualSplashStyle = 1; + private int _actualSplashStyle = 1; private readonly string[] _loadingMessages = { "正在启动 Ink Canvas...", "正在初始化组件...", @@ -37,13 +36,13 @@ namespace Ink_Canvas.Windows { // 设置窗口居中 WindowStartupLocation = WindowStartupLocation.CenterScreen; - + // 设置版本号 SetVersionText(); - + // 加载启动图片并获取实际样式 _actualSplashStyle = LoadSplashImageWithStyle(); - + // 启动加载动画 StartLoadingAnimation(); } @@ -52,7 +51,7 @@ namespace Ink_Canvas.Windows { _timer = new DispatcherTimer { - Interval = TimeSpan.FromMilliseconds(1200) + Interval = TimeSpan.FromMilliseconds(1200) }; _timer.Tick += Timer_Tick; _timer.Start(); @@ -83,7 +82,7 @@ namespace Ink_Canvas.Windows EasingFunction = new CubicEase { EasingMode = EasingMode.EaseIn } }; - fadeOutAnimation.Completed += (s, e) => + fadeOutAnimation.Completed += (s, e) => { this.Close(); }; @@ -101,7 +100,7 @@ namespace Ink_Canvas.Windows { // 设置进度条颜色 SetProgressBarColor(); - + // 获取进度条容器的实际宽度 double containerWidth = ProgressBarBackground.ActualWidth; if (containerWidth <= 0) @@ -109,13 +108,13 @@ namespace Ink_Canvas.Windows // 如果ActualWidth为0,使用设计时宽度 containerWidth = 530; } - + // 计算目标宽度 double targetWidth = containerWidth * (progress / 100.0); - + // 创建Storyboard动画 var storyboard = new Storyboard(); - + // 创建宽度动画 var widthAnimation = new DoubleAnimation { @@ -124,20 +123,20 @@ namespace Ink_Canvas.Windows Duration = TimeSpan.FromMilliseconds(300), EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut } }; - + // 设置动画目标 Storyboard.SetTarget(widthAnimation, ProgressBarFill); Storyboard.SetTargetProperty(widthAnimation, new PropertyPath(Border.WidthProperty)); - + // 添加动画到Storyboard storyboard.Children.Add(widthAnimation); - + // 添加动画完成事件 storyboard.Completed += (s, e) => { // 确保最终值正确设置 ProgressBarFill.Width = targetWidth; - + // 根据进度调整圆角 if (progress >= 100) { @@ -150,7 +149,7 @@ namespace Ink_Canvas.Windows ProgressBarFill.CornerRadius = new CornerRadius(0, 0, 0, 7); } }; - + // 开始动画 storyboard.Begin(); }); @@ -171,7 +170,7 @@ namespace Ink_Canvas.Windows Dispatcher.Invoke(() => { LoadingText.Text = message; - + // 根据实际启动动画样式调整加载文本样式 if (actualSplashStyle == 6) // 马年限定 { @@ -180,7 +179,7 @@ namespace Ink_Canvas.Windows LoadingText.FontWeight = FontWeights.SemiBold; LoadingText.Foreground = Brushes.White; LoadingText.HorizontalAlignment = HorizontalAlignment.Center; - LoadingText.Margin = new Thickness(0,200,140,4); + LoadingText.Margin = new Thickness(0, 200, 140, 4); } else { @@ -189,7 +188,7 @@ namespace Ink_Canvas.Windows LoadingText.FontWeight = FontWeights.SemiBold; LoadingText.Foreground = Brushes.White; LoadingText.HorizontalAlignment = HorizontalAlignment.Center; - LoadingText.Margin = new Thickness(0,200,0,0); + LoadingText.Margin = new Thickness(0, 200, 0, 0); } }); } @@ -282,7 +281,7 @@ namespace Ink_Canvas.Windows catch (Exception ex) { System.Diagnostics.Debug.WriteLine($"加载启动图片失败: {ex.Message}"); - return GetActualStyle(1); + return GetActualStyle(1); } } @@ -296,7 +295,7 @@ namespace Ink_Canvas.Windows // 读取设置 var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "Settings.json"); int splashStyle = 1; // 默认跟随四季 - + if (File.Exists(settingsPath)) { var json = File.ReadAllText(settingsPath); @@ -313,7 +312,7 @@ namespace Ink_Canvas.Windows } catch { - string imageName = GetImageNameByStyle(1); + string imageName = GetImageNameByStyle(1); return $"pack://application:,,,/Resources/Startup-animation/{imageName}"; } } @@ -330,7 +329,7 @@ namespace Ink_Canvas.Windows // 读取设置 var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "Settings.json"); int splashStyle = 1; // 默认跟随四季 - + if (File.Exists(settingsPath)) { var json = File.ReadAllText(settingsPath); @@ -349,7 +348,7 @@ namespace Ink_Canvas.Windows catch { actualStyle = GetActualStyle(1); - string imageName = GetImageNameByStyle(1); + string imageName = GetImageNameByStyle(1); return $"pack://application:,,,/Resources/Startup-animation/{imageName}"; } } @@ -367,16 +366,16 @@ namespace Ink_Canvas.Windows var random = new Random(); var randomStyles = new[] { 2, 3, 4, 5, 6 }; // 春季、夏季、秋季、冬季、马年限定 return randomStyles[random.Next(randomStyles.Length)]; - + case 1: // 跟随四季 var month = DateTime.Now.Month; if (month >= 3 && month <= 5) return 2; // 春季 if (month >= 6 && month <= 8) return 3; // 夏季 if (month >= 9 && month <= 11) return 4; // 秋季 return 5; // 冬季 - + default: - return style; + return style; } } @@ -391,14 +390,14 @@ namespace Ink_Canvas.Windows var random = new Random(); var randomStyles = new[] { 2, 3, 4, 5, 6 }; // 春季、夏季、秋季、冬季、马年限定 return GetImageNameByStyle(randomStyles[random.Next(randomStyles.Length)]); - + case 1: // 跟随四季 var month = DateTime.Now.Month; if (month >= 3 && month <= 5) return GetImageNameByStyle(2); // 春季 if (month >= 6 && month <= 8) return GetImageNameByStyle(3); // 夏季 if (month >= 9 && month <= 11) return GetImageNameByStyle(4); // 秋季 return GetImageNameByStyle(5); // 冬季 - + case 2: // 春季 return "ICC Spring.png"; case 3: // 夏季 @@ -410,7 +409,7 @@ namespace Ink_Canvas.Windows case 6: // 马年限定 return "ICC Horse.png"; default:// 默认返回 - return "ICC Horse.png"; + return "ICC Horse.png"; } } @@ -420,7 +419,7 @@ namespace Ink_Canvas.Windows private void SetProgressBarColor() { Color progressColor; - + switch (_actualSplashStyle) { case 2: // 春季 - H=136, S=15, L=22 @@ -442,14 +441,14 @@ namespace Ink_Canvas.Windows progressColor = Colors.White; break; } - + // 创建渐变画刷 var gradientBrush = new LinearGradientBrush { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(1, 0) }; - + // 根据颜色类型设置渐变 if (_actualSplashStyle == 6) // 马年限定使用白色渐变 { @@ -459,7 +458,7 @@ namespace Ink_Canvas.Windows } else // 其他样式使用HSL颜色的渐变 { - var lighterColor = Color.FromArgb(255, + var lighterColor = Color.FromArgb(255, (byte)Math.Min(255, progressColor.R + 30), (byte)Math.Min(255, progressColor.G + 30), (byte)Math.Min(255, progressColor.B + 30)); @@ -467,12 +466,12 @@ namespace Ink_Canvas.Windows (byte)Math.Max(0, progressColor.R - 30), (byte)Math.Max(0, progressColor.G - 30), (byte)Math.Max(0, progressColor.B - 30)); - + gradientBrush.GradientStops.Add(new GradientStop(lighterColor, 0)); gradientBrush.GradientStops.Add(new GradientStop(progressColor, 0.5)); gradientBrush.GradientStops.Add(new GradientStop(darkerColor, 1)); } - + ProgressBarFill.Background = gradientBrush; } diff --git a/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache b/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache index 57d842b8..c8c2dfbd 100644 Binary files a/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache and b/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache differ diff --git a/privacy.txt b/privacy.txt index 2c50a9ce..608e9852 100644 --- a/privacy.txt +++ b/privacy.txt @@ -1,5 +1,5 @@ 隐私政策 - 本软件指 Ink Canvas 画板软件(以下称本软件)。 + 本软件指 InkCanvasForClass Community Edition(以下称本软件)。 本软件重视用户隐私,本软件尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更有个性化的服务,本软件会按照本隐私权政策的规定使用和披露您的个人信息。 除本隐私权政策另有规定外,在未征得您事先许可的情况下,本软件不会将这些信息对外披露或向第三方提供。本软件会不时更新本隐私权政策。您在同意本软件服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本软件服务使用协议不可分割的一部分。 1. 适用范围