public override IAutomationFocusChangedEventHandler RegisterFocusChangedEvent(Action <AutomationElement> action) { var eventHandler = new UIA3FocusChangedEventHandler(this, action); ComCallWrapper.Call(() => NativeAutomation.AddFocusChangedEventHandler(null, eventHandler)); return(eventHandler); }
public override IDisposable SubscribeToFocusChangedEvent(Action <AutomationElement> action) { var eventHandler = new UIA3FocusChangedEventHandler(this, action); Com.Call(() => this.NativeAutomation.AddFocusChangedEventHandler(null, eventHandler)); return(Disposable.Create(() => this.NativeAutomation.RemoveFocusChangedEventHandler(eventHandler))); }