代码清理

This commit is contained in:
PrefacedCorg
2025-08-03 16:46:33 +08:00
parent 745b798d89
commit 11a5a7fdbe
73 changed files with 5733 additions and 3857 deletions
+21 -10
View File
@@ -1,7 +1,9 @@
using System.Windows.Automation;
namespace Ink_Canvas.Helpers {
internal class WinTabWindowsChecker {
namespace Ink_Canvas.Helpers
{
internal class WinTabWindowsChecker
{
/*
public static bool IsWindowMinimized(string windowName, bool matchFullName = true) {
// 获取Win+Tab预览中的窗口
@@ -40,28 +42,37 @@ namespace Ink_Canvas.Helpers {
}
*/
public static bool IsWindowExisted(string windowName, bool matchFullName = true) {
public static bool IsWindowExisted(string windowName, bool matchFullName = true)
{
// 获取Win+Tab预览中的窗口
AutomationElementCollection windows = AutomationElement.RootElement.FindAll(
TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window));
foreach (AutomationElement window in windows) {
foreach (AutomationElement window in windows)
{
//LogHelper.WriteLogToFile("" + window.Current.Name);
string windowTitle = window.Current.Name;
// 如果窗口标题包含 windowName,则进行检查
if (!string.IsNullOrEmpty(windowTitle) && windowTitle.Contains(windowName)) {
if (matchFullName) {
if (windowTitle.Length == windowName.Length) {
if (!string.IsNullOrEmpty(windowTitle) && windowTitle.Contains(windowName))
{
if (matchFullName)
{
if (windowTitle.Length == windowName.Length)
{
WindowPattern windowPattern = window.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
if (windowPattern != null) {
if (windowPattern != null)
{
return true;
}
}
} else {
}
else
{
WindowPattern windowPattern = window.GetCurrentPattern(WindowPattern.Pattern) as WindowPattern;
if (windowPattern != null) {
if (windowPattern != null)
{
return true;
}
}