Exemplo n.º 1
0
        /// <inheritdoc />
        public override PropertyChangedEventHandlerBase RegisterPropertyChangedEvent(TreeScope treeScope, Action <SHAutomationElement, PropertyId, object> action, PropertyId[] properties)
        {
            var eventHandler = new UIA3PropertyChangedEventHandler(this, action);
            var propertyIds  = properties.Select(p => p.Id).ToArray();

            Automation.NativeAutomation.AddPropertyChangedEventHandler(NativeElement,
                                                                       (UIA.TreeScope)treeScope, null, eventHandler, propertyIds);
            return(eventHandler);
        }
        public override IDisposable SubscribeToPropertyChangedEvent(TreeScope treeScope, Action <AutomationElement, PropertyId, object> action, PropertyId[] properties)
        {
            var eventHandler = new UIA3PropertyChangedEventHandler(this.Automation, action);
            var propertyIds  = properties.Select(p => p.Id).ToArray();

            this.Automation.NativeAutomation.AddPropertyChangedEventHandler(
                this.NativeElement,
                (Interop.UIAutomationClient.TreeScope)treeScope,
                null,
                eventHandler,
                propertyIds);
            return(Disposable.Create(() => this.Automation.NativeAutomation.RemovePropertyChangedEventHandler(this.NativeElement, (UIA3PropertyChangedEventHandler)eventHandler)));
        }