public AutomationElement FindItemByProperty(AutomationElement startAfter, AutomationProperty property, object value)
 {
     try
     {
         return(AutomationElement.Wrap(
                    this._pattern.FindItemByProperty(
                        (startAfter == null) ? null : startAfter.NativeElement,
                        (property == null) ? 0 : property.Id,
                        Utility.UnwrapObject(value))));
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx))
         {
             throw newEx;
         }
         else
         {
             throw;
         }
     }
 }
Ejemplo n.º 2
0
 public static AutomationElement FromPoint(Point pt)
 {
     try
     {
         UIAutomationClient.IUIAutomationElement element =
             Automation.Factory.ElementFromPointBuildCache(
                 Utility.PointManagedToNative(pt),
                 CacheRequest.CurrentNativeCacheRequest);
         return(AutomationElement.Wrap(element));
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx))
         {
             throw newEx;
         }
         else
         {
             throw;
         }
     }
 }
Ejemplo n.º 3
0
 public AutomationElement GetLastChild(AutomationElement element, CacheRequest request)
 {
     Utility.ValidateArgumentNonNull(element, "element");
     Utility.ValidateArgumentNonNull(request, "request");
     try
     {
         return(AutomationElement.Wrap(this._obj.GetLastChildElementBuildCache(
                                           element.NativeElement,
                                           request.NativeCacheRequest)));
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx))
         {
             throw newEx;
         }
         else
         {
             throw;
         }
     }
 }
Ejemplo n.º 4
0
 public AutomationElement FindFirst(TreeScope scope, Condition condition)
 {
     Utility.ValidateArgumentNonNull(condition, "condition");
     try
     {
         UIAutomationClient.IUIAutomationElement elem =
             this._obj.FindFirstBuildCache(
                 (UIAutomationClient.TreeScope)scope,
                 condition.NativeCondition,
                 CacheRequest.CurrentNativeCacheRequest);
         return(AutomationElement.Wrap(elem));
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx))
         {
             throw newEx;
         }
         else
         {
             throw;
         }
     }
 }
Ejemplo n.º 5
0
 private static object ConvertToElement(object value)
 {
     return(AutomationElement.Wrap((UIAutomationClient.IUIAutomationElement)value));
 }