private void SaveNode(TreeNode node, List<TreeNodeItem> nodeItemsList) { TreeNode clonedNode = (TreeNode)node.Clone(); TreeNodeItem nodeItem = new TreeNodeItem(clonedNode); nodeItemsList.Add(nodeItem); foreach (TreeNode childNode in clonedNode.Nodes) { SaveNode(childNode, nodeItem.Nodes); } clonedNode.Nodes.Clear(); }
private void Assign(TreeNodeItem nodeItem, List<TreeNodeItem> nodeItemsList, bool isNodesHiddenDef) { TreeNodeItem clonedNodeItem = nodeItem.Clone(isNodesHiddenDef); nodeItemsList.Add(clonedNodeItem); foreach (TreeNodeItem childItem in nodeItem.Nodes) { Assign(childItem, clonedNodeItem.Nodes, isNodesHiddenDef); } }
private void GetSelectedNodeFullPath(TreeNode node, TreeNodeItem nodeItem, List<string> pathList, ref bool found) { if (nodeItem.Node == node) { found = true; return; } foreach (TreeNodeItem childNodeItem in nodeItem.Nodes) { GetSelectedNodeFullPath(node, childNodeItem, pathList, ref found); if (found) { pathList.Insert(0, childNodeItem.Node.Text); break; } } }
private TreeNode GetFirstFoundNode(TreeNodeItem nodeItem) { if (nodeItem.IsFoundNode) { return nodeItem.Node; } TreeNode foundNode = null; foreach (TreeNodeItem childNodeItem in nodeItem.Nodes) { if ((foundNode = GetFirstFoundNode(childNodeItem)) != null) { break; } } return foundNode; }
private void AssignToTreeNodeCollectionTree(TreeNodeCollection dest, TreeNodeItem nodeItem) { if (!nodeItem.IsNodeHidden) { nodeItem.Node.Nodes.Clear(); dest.Add(nodeItem.Node); foreach (TreeNodeItem childItem in nodeItem.Nodes) { AssignToTreeNodeCollectionTree(nodeItem.Node.Nodes, childItem); } } }
private void ApplySearchFilterTree(TreeNodeItem nodeItem, string filter, ref bool canHide) { bool localCanHide = true; foreach (TreeNodeItem childNodeItem in nodeItem.Nodes) { ApplySearchFilterTree(childNodeItem, filter, ref localCanHide); if (!localCanHide) { canHide = false; } nodeItem.IsNodeHidden = canHide; } if (nodeItem.IsNodeHidden) { FilterNode(this, nodeItem.Node, filter, out canHide); nodeItem.IsNodeHidden = canHide; nodeItem.IsFoundNode = !canHide; } }
private void ApplySearchFilterList(TreeNodeItem nodeItem, string filter) { foreach (TreeNodeItem childNodeItem in nodeItem.Nodes) { ApplySearchFilterList(childNodeItem, filter); } FilterNode(this, nodeItem.Node, filter, out nodeItem.IsNodeHidden); nodeItem.IsFoundNode = !nodeItem.IsNodeHidden; }