Exemple #1
0
        private void addKeyItem_Click(object sender, EventArgs e)
        {
            using (AddKeyForm form = new AddKeyForm()) {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Key key    = form.Key;
                    var regKey = treeView.SelectedNode.Tag as RegistryKey;

                    regKey.SetValue(key.Name, key.Value, key.Type);
                    UpdateKeysView(treeView.SelectedNode);
                }
            }
        }
Exemple #2
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Key oldKey = keysView.FocusedItem.Tag as Key;

            using (AddKeyForm form = new AddKeyForm(oldKey)) {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Key newKey = form.Key;
                    (treeView.SelectedNode.Tag as RegistryKey).DeleteValue(oldKey.Name);
                    (treeView.SelectedNode.Tag as RegistryKey).SetValue(newKey.Name, newKey.Value, newKey.Type);
                    UpdateKeysView(treeView.SelectedNode);
                }
            }
        }