public void RefreshNodeChildren(FilterName filter, Dictionary <string, int> children, ContextMenuStrip menu, DynamicFilter dynamic) { string nodeKey = filter.ToString(); TreeNode[] nodes = Nodes.Find(nodeKey, true); if (nodes.Count() != 1) { return; } TreeNode node = nodes[0]; node.Nodes.Clear(); List <string> list = children.Keys.ToList(); list.Sort(); TreeNode childNode; foreach (string child in list) { string text = String.Format("{0} ({1})", child, children[child].ToString()); childNode = new TreeNode(text, (node.Name.Equals(FilterName.Custom.ToString()) && dynamic.DoNotify(child)) ? this.ImageList.Images.Count - 1 : node.ImageIndex, 0); childNode.Name = child; childNode.Tag = NodeTag.Viewable; childNode.ContextMenuStrip = menu; node.Nodes.Add(childNode); } }
private TreeNode CreateNode(string text, FilterName filter, NodeTag tag, int imgNum) { TreeNode node = new TreeNode(text, imgNum, imgNum); node.Name = filter.ToString(); node.Tag = tag; return(node); }