private void UpdateChildren(AccessiblePath [] childPaths) { bool initializing = (children == null); if (StateSet.Contains (StateType.ManagesDescendants) || (Role == Role.Filler)) { // Do not cache filler to work around BGO#577392 if (!(children is UncachedChildren)) children = new UncachedChildren (this); } else { Accessible [] oldChildren = null; if (children is List<Accessible>) { oldChildren = new Accessible [children.Count]; children.CopyTo (oldChildren, 0); } children = new List<Accessible> (); children.Clear (); foreach (AccessiblePath path in childPaths) { Accessible child = Registry.GetElement (path, true); if (!initializing && (oldChildren == null || Array.IndexOf (oldChildren, child) == -1)) Desktop.RaiseChildAdded (this, child); children.Add (child); } if (!initializing && oldChildren != null) foreach (Accessible child in oldChildren) if (!PathListContains (childPaths, child.application.name, child.path)) Desktop.RaiseChildRemoved (this, child); } }
internal static Accessible GetElement(AccessiblePath ap, bool create) { Application application; application = Instance.GetApplication (ap.bus_name, create); if (application == null) return null; return application.GetElement (ap.path, create); }
private bool PathListContains(AccessiblePath [] paths, string bus_name, string path) { foreach (AccessiblePath child in paths) if (child.bus_name == bus_name && child.path.ToString () == path) return true; return false; }