private void OnChildAdded (Accessible sender, Accessible child)
{
if (sender.Role == Role.DesktopFrame) {
foreach (Accessible frame in child.Children)
OnChildAdded (child, frame);
return;
}
IElement childElement = Element.GetElement (child, true);
if (childElement == null)
return;
if (childElement.Parent != null)
RaiseStructureChangedEvent (childElement.Parent, StructureChangeType.ChildrenInvalidated);
if (child.Role != Role.Application)
RaiseStructureChangedEvent (childElement, StructureChangeType.ChildAdded);
if (child.Role == Role.Frame)
RaiseAutomationEvent (child, WindowPattern.WindowOpenedEvent);
if (sender.Role == Role.Application)
OnRootElementsChanged ();
}