private void btnAdd_Click(object sender, EventArgs e) { dlgSet dlg = new dlgSet(); if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { regApp = regApps.CreateSubKey(dlg.kv.key); regApp.SetValue(null, dlg.kv.value); kvs.Add(dlg.kv); showItem(kvs.Last()); } }
private void mnuAppEdit_Click(object sender, EventArgs e) { int id = lvwApps.SelectedItems[0].Index; dlgSet dlg = new dlgSet(id, kvs[id]); if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { if (dlg.kv.localMachine) { regApp = regAppsEx.CreateSubKey(dlg.kv.key, RegistryKeyPermissionCheck.ReadWriteSubTree); } else { regApp = regApps.CreateSubKey(dlg.kv.key); } regApp.SetValue(null, dlg.kv.value); kvs[id] = dlg.kv; showItem(kvs[id], id); } }