From 7f154ba1db476d30fc13ade263a1e113a353dc65 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 17 Jan 2026 16:46:37 +0800 Subject: [PATCH] =?UTF-8?q?improve:=E8=87=AA=E5=8A=A8=E6=94=B6=E7=BA=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow_cs/MW_Timer.cs | 153 +++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/Ink Canvas/MainWindow_cs/MW_Timer.cs b/Ink Canvas/MainWindow_cs/MW_Timer.cs index 66405895..9dcffc9b 100644 --- a/Ink Canvas/MainWindow_cs/MW_Timer.cs +++ b/Ink Canvas/MainWindow_cs/MW_Timer.cs @@ -507,6 +507,140 @@ namespace Ink_Canvas return windowTitle.Length == 0 && windowRect.Height < 500; } + /// + /// 检查是否存在应当被收纳应用的全屏窗口 + /// + /// 如果存在应当被收纳应用的全屏窗口返回true,否则返回false + private bool HasFullScreenWindowOfAutoFoldApps() + { + if (_windowOverviewModel == null) return false; + + try + { + var fullScreenWindows = _windowOverviewModel.GetFullScreenWindows(); + if (fullScreenWindows == null || fullScreenWindows.Count == 0) return false; + + foreach (var window in fullScreenWindows) + { + var windowProcessName = window.ProcessName; + var windowRect = window.Rect; + + if (windowProcessName == "EasiNote") + { + if (window.ProcessPath != "Unknown") + { + try + { + var versionInfo = FileVersionInfo.GetVersionInfo(window.ProcessPath); + string version = versionInfo.FileVersion; + string prodName = versionInfo.ProductName; + + if (version.StartsWith("5.") && Settings.Automation.IsAutoFoldInEasiNote) + { + return true; + } + else if (version.StartsWith("3.") && Settings.Automation.IsAutoFoldInEasiNote3) + { + return true; + } + else if (prodName.Contains("3C") && Settings.Automation.IsAutoFoldInEasiNote3C) + { + return true; + } + } + catch { } + } + } + else if (Settings.Automation.IsAutoFoldInEasiCamera && windowProcessName == "EasiCamera") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInEasiNote5C && windowProcessName == "EasiNote5C") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInSeewoPincoTeacher && + (windowProcessName == "BoardService" || windowProcessName == "seewoPincoTeacher")) + { + return true; + } + else if (Settings.Automation.IsAutoFoldInHiteCamera && windowProcessName == "HiteCamera") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInHiteTouchPro && windowProcessName == "HiteTouchPro") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInWxBoardMain && windowProcessName == "WxBoardMain") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInMSWhiteboard && + (windowProcessName == "MicrosoftWhiteboard" || windowProcessName == "msedgewebview2")) + { + return true; + } + else if (Settings.Automation.IsAutoFoldInHiteLightBoard && windowProcessName == "HiteLightBoard") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInAdmoxWhiteboard && windowProcessName == "Amdox.WhiteBoard") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInAdmoxBooth && windowProcessName == "Amdox.Booth") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInQPoint && windowProcessName == "QPoint") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInYiYunVisualPresenter && windowProcessName == "YiYunVisualPresenter") + { + return true; + } + else if (Settings.Automation.IsAutoFoldInMaxHubWhiteboard && windowProcessName == "WhiteBoard") + { + if (window.ProcessPath != "Unknown") + { + try + { + var versionInfo = FileVersionInfo.GetVersionInfo(window.ProcessPath); + var version = versionInfo.FileVersion; + var prodName = versionInfo.ProductName; + if (version.StartsWith("6.") && prodName == "WhiteBoard") + { + return true; + } + } + catch { } + } + } + } + + if (Settings.Automation.IsAutoFoldInOldZyBoard && + (WinTabWindowsChecker.IsWindowExisted("WhiteBoard - DrawingWindow") || + WinTabWindowsChecker.IsWindowExisted("InstantAnnotationWindow"))) + { + var oldZyWindows = _windowOverviewModel.Windows.Where(w => + (w.Title.Contains("WhiteBoard - DrawingWindow") || w.Title.Contains("InstantAnnotationWindow")) && + w.IsFullScreen).ToList(); + if (oldZyWindows.Count > 0) + { + return true; + } + } + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"检查全屏窗口失败: {ex.Message}", LogHelper.LogType.Error); + } + + return false; + } + /// /// 使用窗口预览模型检测前台窗口是否符合自动收纳要求(仅用于检测,不执行任何操作) /// @@ -690,6 +824,12 @@ namespace Ink_Canvas if (isFloatingBarChangingHideMode) return; try { + if (HasFullScreenWindowOfAutoFoldApps()) + { + if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null); + return; + } + bool shouldAutoFold = CheckShouldAutoFoldByWindowPreview(); var windowProcessName = ForegroundWindowInfo.ProcessName(); var windowTitle = ForegroundWindowInfo.WindowTitle(); @@ -948,11 +1088,24 @@ namespace Ink_Canvas else if (WinTabWindowsChecker.IsWindowExisted("幻灯片放映", false)) { // 处于幻灯片放映状态 + if (HasFullScreenWindowOfAutoFoldApps()) + { + if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null); + return; + } + if (!Settings.Automation.IsAutoFoldInPPTSlideShow && isFloatingBarFolded && !foldFloatingBarByUser) UnFoldFloatingBar_MouseUp(new object(), null); } else { + if (HasFullScreenWindowOfAutoFoldApps()) + { + if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null); + unfoldFloatingBarByUser = false; + return; + } + // 检查是否启用了软件退出后保持收纳模式 if (Settings.Automation.KeepFoldAfterSoftwareExit) {