Exemple #1
0
        internal static void RemoveNonMemberItems(XProjectNode project)
        {
            IList <HierarchyNode> nodeList = new List <HierarchyNode>();

            XHelperMethods.FindNodes(nodeList, project, XProjectMembers.IsNodeNonMemberItem, null);
            for (int index = nodeList.Count - 1; index >= 0; index--)
            {
                HierarchyNode node   = nodeList[index];
                HierarchyNode parent = node.Parent;
                node.OnItemDeleted();
                parent.RemoveChild(node);
            }
        }
Exemple #2
0
        /// <summary>
        /// Finds child nodes under the parent node and places them in the currentList.
        /// </summary>
        /// <param name="currentList">List to be populated with the nodes.</param>
        /// <param name="parent">Parent node under which the nodes should be searched.</param>
        /// <param name="filter">Filter to be used while selecting the node.</param>
        /// <param name="criteria">Criteria to be used by the filter.</param>
        public static void FindNodes(IList <HierarchyNode> currentList, HierarchyNode parent, XNodeFilter filter, object criteria)
        {
            Utilities.ArgumentNotNull("currentList", currentList);
            Utilities.ArgumentNotNull("parent", parent);
            Utilities.ArgumentNotNull("filter", filter);


            for (HierarchyNode child = parent.FirstChild; child != null; child = child.NextSibling)
            {
                if (filter(child, criteria))
                {
                    currentList.Add(child);
                }

                XHelperMethods.FindNodes(currentList, child, filter, criteria);
            }
        }