示例#1
0
 /// <summary>
 /// Registers a property changed event with the given property.
 /// </summary>
 public IDisposable SubscribeToPropertyChangedEvent(TreeScope treeScope, AutomationProperty property, Action <UiElement, AutomationPropertyChangedEventArgs> action)
 {
     return(this.AutomationElement.SubscribeToPropertyChangedEvent(
                treeScope,
                property,
                (sender, args) => action(FromAutomationElement((AutomationElement)sender), args)));
 }
示例#2
0
 /// <summary>
 /// Subscribe to value changes
 /// </summary>
 /// <param name="element">The <see cref="AutomationElement"/></param>
 /// <param name="treeScope">The <see cref="TreeScope"/></param>
 /// <param name="property">The <see cref="AutomationProperty"/> to subscribe to changes for.</param>
 /// <param name="handler"> The <see cref="AutomationPropertyChangedEventHandler"/>. </param>
 /// <returns>A <see cref="IDisposable"/> that unsubcribes on dispose.</returns>
 public static IDisposable ToPropertyChangedEvent(AutomationElement element, TreeScope treeScope, AutomationProperty property, AutomationPropertyChangedEventHandler handler)
 {
     Automation.AddAutomationPropertyChangedEventHandler(element, treeScope, handler, property);
     return(Disposable.Create(() => Automation.RemoveAutomationPropertyChangedEventHandler(element, handler)));
 }
示例#3
0
 /// <summary>
 /// Method to check if the element supports the given property via UIA method.
 /// Does not work with cached elements and might be unreliable.
 /// </summary>
 public bool IsPropertySupportedDirect(AutomationProperty property)
 {
     return(this.GetSupportedPropertiesDirect().Contains(property));
 }
示例#4
0
 public static IDisposable SubscribeToPropertyChangedEvent(this AutomationElement element, TreeScope treeScope, AutomationProperty property, AutomationPropertyChangedEventHandler handler)
 {
     return(Subscribe.ToPropertyChangedEvent(
                element,
                treeScope,
                property,
                handler));
 }
 protected AutomationProperty <T> GetOrCreate <T>(ref AutomationProperty <T> val, PropertyId propertyId)
 {
     return(val ?? (val = new AutomationProperty <T>(propertyId, this.BasicAutomationElement)));
 }