예제 #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 (!managesDescendants && node.GetInfo().states.Contains("manages descendants"))
                {
                    managesDescendants = true;
                }
            }
            return(path);
        }
        public override bool Equals(AccessibleNode other)
        {
            if (!base.Equals(other))
            {
                return(false);
            }

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

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