public void RemoveStructureChangedEventHandler (IElement element,
StructureChangedEventHandler eventHandler)
{
int handlerId = eventHandlerManager.GetStructureEventIdByHandler (eventHandler);
if (handlerId == -1)
return;
if (element == null) {
//the element is the RootElement
RootElementEventsManager.RemoveStructureEventRequest (handlerId);
foreach (var entry in GetUiaApplications ())
entry.Value.RemoveRootElementStructureChangedEventHandler (handlerId);
} else {
UiaDbusElement uiaDbusElement = element as UiaDbusElement;
if (uiaDbusElement == null) {
Log.Error ("[RemoveStructureChangedEventHandler] " +
"The element sent to UiaDbusSource is not UiaDbusElement");
return;
}
string busName = uiaDbusElement.BusName;
DCI.IApplication app = Bus.Session.GetObject<DCI.IApplication> (busName,
new ObjectPath (DC.Constants.ApplicationPath));
int [] runtimeId = uiaDbusElement.RuntimeId;
app.RemoveStructureChangedEventHandler (runtimeId, handlerId);
}
}