void IUIAutomationEventHandler.HandleAutomationEvent( IUIAutomationElement sender, int eventId) { AutomationElement automationElement = null; if (sender != null) { automationElement = new AutomationElement(autoElement: sender); } if (eventId == 20017) { this._handlingDelegate(sender: automationElement, e: new WindowClosedEventArgs(runtimeId: automationElement.GetRuntimeId())); } else { this._handlingDelegate(sender: automationElement, e: new AutomationEventArgs(eventId: AutomationEvent.LookupById(id: eventId))); } }