Exemple #1
0
        public static List <AutomationElement> ToList(this AutomationElementCollection c)
        {
            var l = new List <AutomationElement>();
            var e = c.GetEnumerator();

            while (e.MoveNext())
            {
                l.Add((AutomationElement)e.Current);
            }
            return(l);
        }
Exemple #2
0
 public void LoopElement(AutomationElement ParentElement, TreeNode ParentNode)
 {
     try
     {
         AutomationElementCollection automationElementCollection = ParentElement.FindAll(TreeScope.Children, Condition.TrueCondition);
         IEnumerator enumerator = null;
         try
         {
             enumerator = automationElementCollection.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 AutomationElement  automationElement = (AutomationElement)enumerator.Current;
                 TreeNodeCollection arg_59_0          = ParentNode.Nodes;
                 AutomationElement.AutomationElementInformation current = automationElement.Current;
                 string arg_54_0 = current.Name;
                 string arg_54_1 = " ";
                 current = automationElement.Current;
                 TreeNode treeNode = arg_59_0.Add(arg_54_0 + arg_54_1 + current.LocalizedControlType.ToString());
                 this.dic.Add(treeNode, automationElement);
                 bool flag = automationElement.Equals(this.CurrentElement);
                 if (flag)
                 {
                     this.CurrentNode = treeNode;
                 }
                 this.LoopElement(automationElement, treeNode);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
     }
     catch (ElementNotAvailableException expr_BA)
     {
         ProjectData.SetProjectError(expr_BA);
         ProjectData.ClearProjectError();
     }
 }