private void ChildDeleted(HierarchyNode child) { if (child == null) { throw new InvalidOperationException("Deleted, but child is null."); } this.project.TryDeactivateSymLinkWatcher(child); // rapid changes can arrive out of order, if the file or directory // actually exists ignore the event. if ((!File.Exists(child.Url) && !Directory.Exists(child.Url)) || this.project.IsFileHidden(child.Url)) { if (child.ItemNode == null) { // nodes should all have ItemNodes, the project is special. Debug.Assert(child is ProjectNode); return; } if (child.ItemNode.IsExcluded) { this.RemoveAllFilesChildren(child); // deleting a show all files item, remove the node. this.project.OnItemDeleted(child); child.Parent.RemoveChild(child); child.Close(); } else { Debug.Assert(!child.IsNonMemberItem); // deleting an item in the project, fix the icon, also // fix the icon of all children which we may have not // received delete notifications for this.RedrawIcon(child); } } }