ACAT.Lib.Extension.AppAgents.WindowsExplorer.WindowsExplorerAgentBase.isDesktopWindow C# (CSharp) Метод

isDesktopWindow() защищенный Метод

Checks if the focused element is the desktop
protected isDesktopWindow ( AutomationElement focusedElement ) : bool
focusedElement System.Windows.Automation.AutomationElement element in focus
Результат bool
        protected bool isDesktopWindow(AutomationElement focusedElement)
        {
            Log.Debug();
            var walker = TreeWalker.ControlViewWalker;

            AutomationElement parent = focusedElement;

            while (parent != null)
            {
                Log.Debug("class: " + parent.Current.ClassName + ", ctrltype: " + parent.Current.ControlType.ProgrammaticName + ", name: " + parent.Current.Name);
                if (parent == AutomationElement.RootElement ||
                    (String.Compare(parent.Current.ClassName, "SysListView32", true) == 0 &&
                        String.Compare(parent.Current.ControlType.ProgrammaticName, "ControlType.List", true) == 0 &&
                        String.Compare(parent.Current.AutomationId, "1", true) == 0 &&
                        String.Compare(parent.Current.Name, "FolderView", true) == 0) ||
                    (String.Compare(parent.Current.ClassName, "Shell_TrayWnd", true) == 0 &&
                        String.Compare(parent.Current.ControlType.ProgrammaticName, "ControlType.Pane", true) == 0))
                {
                    Log.Debug("Returning true");
                    return true;
                }
                parent = walker.GetParent(parent);
            }
            Log.Debug("Returning false");
            return false;
        }