示例#1
0
        private AutomationElement ListItemElementFromPoint(AutomationElementFactory factory, Point pt)
        {
            if (PInvoke.WindowFromPoint(pt) != Handle)
            {
                return(null);
            }
            AutomationElement elem = factory.FromPoint(pt);

            if (elem == null)
            {
                return(null);
            }
            if (elem.GetClassName() == "UIItem")
            {
                return(elem);
            }
            elem = elem.GetParent();
            if (elem == null)
            {
                return(null);
            }
            if (elem.GetClassName() == "UIItem")
            {
                return(elem);
            }
            return(null);
        }
示例#2
0
 public static T DoQuery <T>(Query <T> query)
 {
     try {
         return((T)automationDispatch.Invoke(new Func <T>(() => {
             try {
                 using (AutomationElementFactory factory = new AutomationElementFactory(pAutomation)) {
                     return query(factory);
                 }
             }
             catch (Exception exception) {
                 QTUtility2.MakeErrorLog(exception, "Automation Thread");
                 return default(T);
             }
         }), DispatcherPriority.Normal));
     }
     catch {
         return(default(T));
     }
 }
示例#3
0
 internal AutomationElement(IUIAutomationElement pElement, AutomationElementFactory factory)
 {
     this.factory  = factory;
     this.pElement = pElement;
     factory.AddToDisposeList(this);
 }