Пример #1
0
        /// <summary>
        /// Creates TreeNode for the AutomationElement
        /// </summary>
        public static TreeNode CreateNodeForAutomationElement(AutomationElement element, AutomationElementTreeControl parentControl)
        {
//            System.Diagnostics.Debug.WriteLine("CreateNodeForAutomationElement...");

            TreeNode node = new TreeNode(TreeHelper.GetAutomationElementTreeNodeText(element));
            node.Tag = new AutomationElementTreeNode(element, node, parentControl);

            if ((bool)element.GetCurrentPropertyValue(AutomationElement.IsContentElementProperty))
            {
                node.ForeColor = Color.Black; //.NodeFont = new Font(FontFamily.GenericSerif, 10, FontStyle.Bold);
            }
            else
            {
                node.ForeColor = Color.DarkGray;
            }


            /*************************************************/
            // this is only for test purposes, it makes the creation of each TreeNode slower
            //DateTime now = DateTime.Now;
            //DateTime endTime = now.AddMilliseconds(400);

            //while (DateTime.Now < endTime) ;
            /*************************************************/

//            System.Diagnostics.Debug.WriteLine("CreateNodeForAutomationElement EXIT");

            return node;
        }
        internal AutomationElementTreeNode(AutomationElement element, TreeNode node, AutomationElementTreeControl automationElementTreeControl)
        {
            Debug.Assert(element != null);
            this.AutomationElement = element;

            this.TreeNode = node;
            this.AutomationElementTreeControl = automationElementTreeControl;
        }
Пример #3
0
        internal AutomationElementTreeNode(AutomationElement element, TreeNode node, AutomationElementTreeControl automationElementTreeControl)
        {
            Debug.Assert(element != null);
            this.AutomationElement = element;

            this.TreeNode = node;
            this.AutomationElementTreeControl = automationElementTreeControl;
        }
Пример #4
0
        /// <summary>
        /// creates appropriate ElementHighLighter according to the id
        /// </summary>
        /// <returns>new instance of ElementHighLighter</returns>
        public static ElementHighlighter CreateHighlighterById(string id, AutomationElementTreeControl treeControl)
        {
            Debug.Assert(id != null);

            switch (id.ToUpper())
            {
                case BoundingRectangle: return new BoundingRectangleElementHighLighter(treeControl);
                case FadingBoundingRectangle: return new FadingBoundingRectangleElementHighLighter(treeControl);
                case BoundingRectangleAndRays: return new RaysAndBoundingRectangleElementHighlighter(treeControl);

                default:
                    throw new ArgumentException(String.Format("Invalid argument value {0}", id));
            }
        }
Пример #5
0
 public ElementHighlighter(AutomationElementTreeControl treeControl)
 {
     Debug.Assert(treeControl != null);
     this._treeControl = treeControl;
 }
Пример #6
0
        public RaysAndBoundingRectangleElementHighlighter(AutomationElementTreeControl treeControl) : base(treeControl)
        {
            _topLeftVerticalRay = new ScreenRectangle();
            _topLeftHorizontalRay = new ScreenRectangle();
            _topRightVerticalRay = new ScreenRectangle();
            _topRightHorizontalRay = new ScreenRectangle();
            _bottomLeftVerticalRay = new ScreenRectangle();
            _bottomLeftHorizontalRay = new ScreenRectangle();
            _bottomRightVerticalRay = new ScreenRectangle();
            _bottomRightHorizontalRay = new ScreenRectangle();

            this._rays = new ScreenRectangle[] { _topLeftVerticalRay , _topLeftHorizontalRay ,
                _topRightVerticalRay , _topRightHorizontalRay ,
                _bottomLeftVerticalRay , _bottomLeftHorizontalRay ,
                _bottomRightVerticalRay , _bottomRightHorizontalRay };

            double boundingRectOpacity = base._rectangle.Opacity;

            foreach (ScreenRectangle ray in this._rays)
            {
                ray.Color = Drawing.Color.Blue;
                ray.Opacity = boundingRectOpacity;
            }
        }
Пример #7
0
 public FadingBoundingRectangleElementHighLighter(AutomationElementTreeControl treeControl) : base(treeControl) { }
Пример #8
0
 public BoundingRectangleElementHighLighter(AutomationElementTreeControl treeControl) : base(treeControl)
 {
     _rectangle.Color = Drawing.Color.Red;
     _rectangle.Opacity = 0.8;
 }
Пример #9
0
        /// <summary>
        /// this will stop highlighting, release all handlers and references.
        /// </summary>
        public void Dispose()
        {
            if (!_isDisposed)
            {
                StopHighlighting();
                OnDispose();

                _treeControl = null;
                _isDisposed = true;
            }
        }
Пример #10
0
        /// <summary>
        /// Creates TreeNode for the AutomationElement
        /// </summary>
        public static TreeNode CreateNodeForAutomationElement(AutomationElement element, AutomationElementTreeControl parentControl)
        {
//            System.Diagnostics.Debug.WriteLine("CreateNodeForAutomationElement...");

            TreeNode node = new TreeNode(TreeHelper.GetAutomationElementTreeNodeText(element));

            node.Tag = new AutomationElementTreeNode(element, node, parentControl);

            if ((bool)element.GetCurrentPropertyValue(AutomationElement.IsContentElementProperty))
            {
                node.ForeColor = Color.Black; //.NodeFont = new Font(FontFamily.GenericSerif, 10, FontStyle.Bold);
            }
            else
            {
                node.ForeColor = Color.DarkGray;
            }


            /*************************************************/
            // this is only for test purposes, it makes the creation of each TreeNode slower
            //DateTime now = DateTime.Now;
            //DateTime endTime = now.AddMilliseconds(400);

            //while (DateTime.Now < endTime) ;
            /*************************************************/

//            System.Diagnostics.Debug.WriteLine("CreateNodeForAutomationElement EXIT");

            return(node);
        }
Пример #11
0
 public FocusTracer(AutomationElementTreeControl TreeControl)
 {
     this._treeControl = TreeControl;
 }
Пример #12
0
 /// <summary>
 /// initialize with tree control
 /// </summary>
 public HoverMode(AutomationElementTreeControl TreeControl)
 {
     this._treeControl = TreeControl;
 }