private void EnsureStructureEventsSetUp (DCI.IApplication app, string busName)
{
if (!structureEventBusNames.Contains (busName)) {
structureEventBusNames.Add (busName);
app.StructureChanged += delegate (int hId, int evtId, string providerPath,
StructureChangeType changeType) {
var handler = eventHandlerManager.GetStructureEventHandlerById (hId);
if (handler != null) {
UiaDbusElement elem = GetOrCreateElement (busName, providerPath);
AutomationElement ae = SourceManager.GetOrCreateAutomationElement (elem);
var args = new StructureChangedEventArgs (changeType, elem.RuntimeId);
handler (ae, args);
}
};
}
}