示例#1
0
 private AT GetInvokerElementByPropertyType(AT parent, string propertyType, string propertyValue, string controlTypeValue)
 {
     if (propertyType.Equals(StructPropertyType.index))
     {
         return(parent.GetElement(treeScope: ATElement.TreeScope.Descendants, index: int.Parse(propertyValue), controlType: controlTypeValue));
     }
     else if (propertyType.Equals(StructPropertyType.name))
     {
         return(parent.GetElement(treeScope: ATElement.TreeScope.Descendants, name: propertyValue, controlType: controlTypeValue));
     }
     else if (propertyType.Equals(StructPropertyType.className))
     {
         return(parent.GetElement(treeScope: ATElement.TreeScope.Descendants, className: propertyValue, controlType: controlTypeValue));
     }
     else if (propertyType.Equals(StructPropertyType.id))
     {
         return(parent.GetElement(automationId: propertyValue, controlType: controlTypeValue));
     }
     else if (propertyType.Equals(StructPropertyType.hwnd))
     {
         return(parent.GetElementFromHwnd(new IntPtr(Convert.ToInt32(propertyValue))));
     }
     return(null);
 }