示例#1
0
        private void Generate_Click(object sender, EventArgs e)
        {
            TreeNode parentNode = treeView1.SelectedNode;

            Element.Element treeNodeData = parentNode.Tag as Element.Element;
            while (parentNode.Parent.Text != "Desktop")
            {
                parentNode = parentNode.Parent;
            }
            if (!checkBox1.Checked)
            {
                outputView.Clear();
            }
            if (treeNodeData.Type != Element.UIType.Button)
            {
                MessageBox.Show("not support in this demo version");
                return;
            }
            string code = UIAutomationHelperDemo.GenerateCode.ASF.Instance.GetButtonTD(treeNodeData.UIEle, parentNode.Text);

            if (checkBox1.Checked)
            {
                outputView.Text += code;
            }
            else
            {
                outputView.Text = code;
            }
        }
示例#2
0
 private TreeNode Generate_Tree(TreeNode root,AutomationElementCollection UIElems,Element.UIType ElemType,AutomationElement Target=null)
 {
     TreeNode returnNode = null;
     foreach (AutomationElement each in UIElems)
     {
         Element.Element eachNode = new Element.Element(each.Current.Name, ElemType, each);
         TreeNode eachTreeNode = new TreeNode(eachNode.Name);
         eachTreeNode.Tag = eachNode;
         root.Nodes.Add(eachTreeNode);
         if ((Target != null) && (Target == each))
         {
             returnNode = eachTreeNode;
         }
     }
     return returnNode;
 }
示例#3
0
        private TreeNode Generate_Tree(TreeNode root, AutomationElementCollection UIElems, Element.UIType ElemType, AutomationElement Target = null)
        {
            TreeNode returnNode = null;

            foreach (AutomationElement each in UIElems)
            {
                Element.Element eachNode     = new Element.Element(each.Current.Name, ElemType, each);
                TreeNode        eachTreeNode = new TreeNode(eachNode.Name);
                eachTreeNode.Tag = eachNode;
                root.Nodes.Add(eachTreeNode);
                if ((Target != null) && (Target == each))
                {
                    returnNode = eachTreeNode;
                }
            }
            return(returnNode);
        }
示例#4
0
 private void Item_Select(object sender, TreeViewEventArgs e)
 {
     if (e.Node.Text == "Desktop")
     {
         return;
     }
     Element.Element treeNodeData = e.Node.Tag as Element.Element;
     try
     {
         PatternComBox.BeginUpdate();
         AutomationElement   UIElem             = treeNodeData.UIEle;
         AutomationPattern[] SupporttedPatterns = UILib.UIAutomationAccess.Instance.GetSupporttedPatterns(UIElem);
         PatternComBox.Items.Clear();
         foreach (AutomationPattern each in SupporttedPatterns)
         {
             PatternComBox.Items.Add(each.ProgrammaticName.Replace("Identifiers.Pattern", ""));
         }
     }
     finally
     {
         PatternComBox.EndUpdate();
     }
 }