public object GetCachedPropertyValue(AutomationProperty property, bool ignoreDefaultValue) { Validate.ArgumentNotNull(parameter: property, parameterName: nameof(property)); var cachedPropertyValueEx = IUIAutomationElement.GetCachedPropertyValueEx(propertyId: property.Id, ignoreDefaultValue: Convert.ToInt32(value: ignoreDefaultValue)); return(UiaConvert.ConvertPropertyValue(property: property, propertyValueVariant: cachedPropertyValueEx)); }
public AutomationElement FindFirst(TreeScope scope, Condition condition) { Validate.ArgumentNotNull(parameter: condition, parameterName: nameof(condition)); var firstBuildCache = IUIAutomationElement.FindFirstBuildCache(scope: UiaConvert.Convert(treeScope: scope), condition: condition.IUIAutomationCondition, cacheRequest: DefaultCacheRequest.IUIAutomationCacheRequest); return(firstBuildCache != null ? new AutomationElement(autoElement: firstBuildCache) : null); }
public AutomationElementCollection FindAll( TreeScope scope, Condition condition) { Validate.ArgumentNotNull(parameter: condition, parameterName: nameof(condition)); var allBuildCache = IUIAutomationElement.FindAllBuildCache(scope: UiaConvert.Convert(treeScope: scope), condition: condition.IUIAutomationCondition, cacheRequest: DefaultCacheRequest.IUIAutomationCacheRequest); return(allBuildCache != null ? new AutomationElementCollection(elementArray: allBuildCache) : null); }
public object GetCurrentPropertyValue(AutomationProperty property, bool ignoreDefaultValue) { Validate.ArgumentNotNull(parameter: property, parameterName: nameof(property)); var propertyValueVariant = new Variant(); try { propertyValueVariant = IUIAutomationElement.GetCurrentPropertyValueEx(propertyId: property.Id, ignoreDefaultValue: Convert.ToInt32(value: ignoreDefaultValue)); } catch (COMException ex) { } return(UiaConvert.ConvertPropertyValue(property: property, propertyValueVariant: propertyValueVariant)); }
public AutomationElement GetUpdatedCache(CacheRequest request) { try { return(new AutomationElement(autoElement: IUIAutomationElement.BuildUpdatedCache(cacheRequest: request.IUIAutomationCacheRequest))); } catch (COMException ex) { Exception exception = null; if (UiaConvert.ConvertException(e: ex, newException: out exception)) { throw exception; } throw; } }
internal static R UIAutomation <R>(Func <R> f) { try { return(f()); } catch (COMException ex) { Exception exception; if (UiaConvert.ConvertException(e: ex, newException: out exception)) { throw exception; } throw; } }
internal static void UIAutomation(Action a) { try { a(); } catch (COMException ex) { Exception exception; if (UiaConvert.ConvertException(e: ex, newException: out exception)) { throw exception; } throw; } }
internal static void Add( AutomationElement element, TreeScope scope, StructureChangedEventHandler handlingDelegate) { var e = new StructureChangedEventHandlerImpl(uiAutomationElement: element.IUIAutomationElement, handlingDelegate: handlingDelegate); var cacheRequest = AutomationElement.DefaultCacheRequest.IUIAutomationCacheRequest; Boundary.UIAutomation(a: () => Automation.AutomationClass.AddStructureChangedEventHandler(element: e._uiAutomationElement, scope: UiaConvert.Convert(treeScope: scope), cacheRequest: cacheRequest, handler: e)); Add(instance: e); }
void IUIAutomationStructureChangedEventHandler.HandleStructureChangedEvent( IUIAutomationElement sender, UIAutomationClient.StructureChangeType changeType, int[] runtimeId) { AutomationElement automationElement = null; if (sender != null) { automationElement = new AutomationElement(autoElement: sender); } this._handlingDelegate(sender: automationElement, e: new StructureChangedEventArgs(structureChangeType: UiaConvert.Convert(structureChangeType: changeType), runtimeId: runtimeId)); }
public void ScrollVertical(ScrollAmount amount) { this._scrollPattern.Scroll(horizontalAmount: UiaConvert.Convert(scrollAmount: ScrollAmount.NoAmount), verticalAmount: UiaConvert.Convert(scrollAmount: amount)); }
public void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount) { this._scrollPattern.Scroll(horizontalAmount: UiaConvert.Convert(scrollAmount: horizontalAmount), verticalAmount: UiaConvert.Convert(scrollAmount: verticalAmount)); }
public void SetDockPosition(DockPosition dockPosition) { this._dockPattern.SetDockPosition(dockPos: UiaConvert.Convert(position: dockPosition)); }
public void SetWindowVisualState(WindowVisualState state) { this._windowPattern.SetWindowVisualState(state: UiaConvert.Convert(state: state)); }
internal static void Add( AutomationElement element, TreeScope scope, AutomationPropertyChangedEventHandler handlingDelegate, AutomationProperty[] properties) { var e = new AutomationPropertyChangedEventHandlerImpl(uiAutomationElement: element.IUIAutomationElement, handlingDelegate: handlingDelegate); var cacheRequest = AutomationElement.DefaultCacheRequest.IUIAutomationCacheRequest; var propertiesArray = properties.Select(selector: p => p.Id).ToArray(); Boundary.UIAutomation(a: () => Automation.AutomationClass.AddPropertyChangedEventHandler(element: e._uiAutomationElement, scope: UiaConvert.Convert(treeScope: scope), cacheRequest: cacheRequest, handler: e, propertyArray: propertiesArray)); Add(instance: e); }