public ITreeWalker GetCustomTreeWalker(ConditionBase condition) { var nativeCondition = ConditionConverter.ToNative(condition); var nativeTreeWalker = new UIA.TreeWalker(nativeCondition); return(new UIA2TreeWalker(_automation, nativeTreeWalker)); }
/// <inheritdoc /> public ITreeWalker GetCustomTreeWalker(ConditionBase condition) { var nativeCondition = ConditionConverter.ToNative(_automation, condition); var nativeTreeWalker = _automation.NativeAutomation.CreateTreeWalker(nativeCondition); return(new UIA3TreeWalker(_automation, nativeTreeWalker)); }
public override AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition) { var nativeFoundElement = CacheRequest.IsCachingActive ? NativeElement.FindFirstBuildCache((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), CacheRequest.Current.ToNative(Automation)) : NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition)); return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement)); }
/// <inheritdoc /> public override AutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition) { var nativeFoundElements = CacheRequest.IsCachingActive ? NativeElement.FindAllBuildCache((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), CacheRequest.Current.ToNative(Automation)) : NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition)); var nativeElement = nativeFoundElements.GetElement(index); return(nativeElement == null ? null : AutomationElementConverter.NativeToManaged(Automation, nativeElement)); }
/// <inheritdoc /> public override AutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition, TreeTraversalOptions traversalOptions, AutomationElement root) { var nativeFoundElement = CacheRequest.IsCachingActive ? NativeElement7.FindFirstWithOptionsBuildCache((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), CacheRequest.Current.ToNative(Automation), (UIA.TreeTraversalOptions)traversalOptions, root.ToNative()) : NativeElement7.FindFirstWithOptions((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), (UIA.TreeTraversalOptions)traversalOptions, root.ToNative()); return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement)); }
public static UIA.IUIAutomationCacheRequest ToNative(this CacheRequest cacheRequest, UIA3Automation automation) { var nativeCacheRequest = automation.NativeAutomation.CreateCacheRequest(); nativeCacheRequest.AutomationElementMode = (UIA.AutomationElementMode)cacheRequest.AutomationElementMode; nativeCacheRequest.TreeFilter = ConditionConverter.ToNative(automation, cacheRequest.TreeFilter); nativeCacheRequest.TreeScope = (UIA.TreeScope)cacheRequest.TreeScope; foreach (var pattern in cacheRequest.Patterns) { nativeCacheRequest.AddPattern(pattern.Id); } foreach (var property in cacheRequest.Properties) { nativeCacheRequest.AddProperty(property.Id); } return(nativeCacheRequest); }
public static UIA.CacheRequest ToNative(this CacheRequest cacheRequest) { var nativeCacheRequest = new UIA.CacheRequest(); nativeCacheRequest.AutomationElementMode = (UIA.AutomationElementMode)cacheRequest.AutomationElementMode; nativeCacheRequest.TreeFilter = ConditionConverter.ToNative(cacheRequest.TreeFilter); nativeCacheRequest.TreeScope = (UIA.TreeScope)cacheRequest.TreeScope; foreach (var pattern in cacheRequest.Patterns) { nativeCacheRequest.Add(UIA.AutomationPattern.LookupById(pattern.Id)); } foreach (var property in cacheRequest.Properties) { nativeCacheRequest.Add(UIA.AutomationProperty.LookupById(property.Id)); } return(nativeCacheRequest); }
/// <inheritdoc /> public override SHAutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition) { var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition)); var nativeElement = nativeFoundElements.GetElement(index); return(nativeElement == null ? null :SHAutomationElementConverter.NativeToManaged(Automation, nativeElement)); }
/// <inheritdoc /> public override SHAutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition, TreeTraversalOption traversalOptions, SHAutomationElement root) { var nativeFoundElement = NativeElement7.FindFirstWithOptions((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), (UIA.TreeTraversalOptions)traversalOptions, SHAutomationElementConverter.ToNative(root)); return(SHAutomationElementConverter.NativeToManaged(Automation, nativeFoundElement)); }
/// <inheritdoc /> public override SHAutomationElement FindFirst(TreeScope treeScope, ConditionBase condition) { var nativeFoundElement = NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition)); return(SHAutomationElementConverter.NativeToManaged(Automation, nativeFoundElement)); }
/// <inheritdoc /> public override SHAutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition) { var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition)); return(SHAutomationElementConverter.NativeArrayToManaged(Automation, nativeFoundElements)); }
/// <inheritdoc /> public override AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition) { var cacheRequest = CacheRequest.IsCachingActive ? CacheRequest.Current.ToNative() : null; cacheRequest?.Push(); var nativeFoundElement = NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(condition)); cacheRequest?.Pop(); return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement)); }
/// <inheritdoc /> public override AutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition) { var cacheRequest = CacheRequest.IsCachingActive ? CacheRequest.Current.ToNative() : null; cacheRequest?.Push(); var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(condition)); cacheRequest?.Pop(); var nativeElement = nativeFoundElements.Count > index ? nativeFoundElements[index] : null; return(nativeElement == null ? null : AutomationElementConverter.NativeToManaged(Automation, nativeElement)); }