예제 #1
0
        private void addNodeItem_Click(object sender, EventArgs e)
        {
            using (AddNodeForm form = new AddNodeForm()) {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    (treeView.SelectedNode.Tag as RegistryKey).CreateSubKey(form.nodeName);

                    UpdateTreeView();
                }
            }
        }
예제 #2
0
        private void renameNodeItem_Click(object sender, EventArgs e)
        {
            using (AddNodeForm form = new AddNodeForm()) {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    var parent = treeView.SelectedNode.Parent.Tag as RegistryKey;
                    RegistryUtilities.RenameSubKey(parent,
                                                   treeView.SelectedNode.Text,
                                                   form.nodeName);

                    var curNode = treeView.SelectedNode;

                    treeView.SelectedNode = treeView.SelectedNode.Parent;
                    UpdateTreeView();
                    treeView.SelectedNode = curNode;
                }
            }
            UpdateTreeView();
        }