示例#1
0
        public static Path <AccessibleNode> BuildNodePath(this AccessibleNode childNode)
        {
            var path = new Path <AccessibleNode>();

            while (childNode != null)
            {
                path.AddRoot(childNode);
                childNode = childNode.GetParent();
                if (path.Count > 1024)
                {
                    throw new InvalidOperationException("Node path is too deep (more than 1024 parents). Is there a cycle in the parent chain?");
                }
            }

            // Set the "manageDescendants" flag where needed
            var managesDescendants = false;

            foreach (var node in path.OfType <AccessibleContextNode>())
            {
                node.SetManagedDescendant(managesDescendants);
                if (node.GetInfo() == null)
                {
                    continue;
                }
                if (!managesDescendants && node.GetInfo().states.Contains("manages descendants"))
                {
                    managesDescendants = true;
                }
            }
            return(path);
        }
示例#2
0
        public override bool Equals(AccessibleNode other)
        {
            if (!base.Equals(other))
            {
                return(false);
            }

            if (!(other is AccessibleWindow))
            {
                return(false);
            }

            return(_hwnd == ((AccessibleWindow)other)._hwnd);
        }