/// <inheritdoc /> public override StructureChangedEventHandlerBase RegisterStructureChangedEvent(TreeScope treeScope, Action <SHAutomationElement, StructureChangeType, int[]> action) { var eventHandler = new UIA3StructureChangedEventHandler(this, action); Automation.NativeAutomation.AddStructureChangedEventHandler(NativeElement, (UIA.TreeScope)treeScope, null, eventHandler); return(eventHandler); }
public override IDisposable SubscribeToStructureChangedEvent(TreeScope treeScope, Action <AutomationElement, StructureChangeType, int[]> action) { var eventHandler = new UIA3StructureChangedEventHandler(this.Automation, action); this.Automation.NativeAutomation.AddStructureChangedEventHandler(this.NativeElement, (Interop.UIAutomationClient.TreeScope)treeScope, null, eventHandler); return(Disposable.Create(() => this.Automation.NativeAutomation.RemoveStructureChangedEventHandler(this.NativeElement, (UIA3StructureChangedEventHandler)eventHandler))); }