private void EnsureAutomationEventsSetUp (DCI.IApplication app, string busName)
{
if (!automationEventBusNames.Contains (busName)) {
automationEventBusNames.Add (busName);
app.AutomationEvent += delegate (int hId, int evtId, string providerPath) {
var handler = eventHandlerManager.GetAutomationEventHandlerById (hId);
if (handler != null) {
UiaDbusElement elem = GetOrCreateElement (busName, providerPath);
AutomationElement ae = SourceManager.GetOrCreateAutomationElement (elem);
var args = new AutomationEventArgs (AutomationEvent.LookupById (evtId));
handler (ae, args);
}
};
}
}