public void AddKeysToTree(string rootName, RegSeekerMatch[] matches) { if (string.IsNullOrEmpty(rootName)) { tvRegistryDirectory.Invoke((MethodInvoker)delegate { tvRegistryDirectory.BeginUpdate(); foreach (var match in matches) { AddRootKey(match); } tvRegistryDirectory.SelectedNode = tvRegistryDirectory.Nodes[0]; tvRegistryDirectory.EndUpdate(); }); } else { TreeNode parent = GetTreeNode(rootName); if (parent != null) { tvRegistryDirectory.Invoke((MethodInvoker)delegate { tvRegistryDirectory.BeginUpdate(); foreach (var match in matches) { //This will execute in the form thread TreeNode node = CreateNode(match.Key, match.Key, match.Data); if (match.HasSubKeys) node.Nodes.Add(new TreeNode()); parent.Nodes.Add(node); } parent.Expand(); tvRegistryDirectory.EndUpdate(); }); } } }
public void AddKeyToTree(string rootKey, RegSeekerMatch match) { TreeNode parent = GetTreeNode(rootKey); tvRegistryDirectory.Invoke((MethodInvoker)delegate { //This will execute in the form thread TreeNode node = CreateNode(match.Key, match.Key, match.Data); if (match.HasSubKeys) node.Nodes.Add(new TreeNode()); parent.Nodes.Add(node); if (!parent.IsExpanded) { tvRegistryDirectory.SelectedNode = parent; tvRegistryDirectory.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.specialCreateRegistryKey_AfterExpand); parent.Expand(); } else { tvRegistryDirectory.SelectedNode = node; tvRegistryDirectory.LabelEdit = true; node.BeginEdit(); } }); }
private void AddRootKey(RegSeekerMatch match) { TreeNode node = CreateNode(match.Key, match.Key, match.Data); node.Nodes.Add(new TreeNode()); tvRegistryDirectory.Nodes.Add(node); }