private void _buttonAdd_Click(object sender, EventArgs e) { using (EditVariableDialog dialog = new EditVariableDialog()) { dialog.ApplyParams("", ""); if (dialog.ShowDialog(this) == DialogResult.OK) { string name = dialog.VariableName; string value = dialog.VariableValue; DeleteItem(name); AddItem(name, value); } } }
private void _buttonEdit_Click(object sender, EventArgs e) { if (_listViewVariables.SelectedItems.Count == 0) { return; } ListViewItem selectedItem = _listViewVariables.SelectedItems[0]; string oldName = selectedItem.SubItems[0].Text; string oldValue = selectedItem.SubItems[1].Text; using (EditVariableDialog dialog = new EditVariableDialog()) { dialog.ApplyParams(oldName, oldValue); if (dialog.ShowDialog(this) == DialogResult.OK) { string name = dialog.VariableName; string value = dialog.VariableValue; DeleteItem(oldName); DeleteItem(name); AddItem(name, value); } } }
private void _buttonEdit_Click(object sender, EventArgs e) { if (_listViewVariables.SelectedItems.Count == 0) return; ListViewItem selectedItem = _listViewVariables.SelectedItems[0]; string oldName = selectedItem.SubItems[0].Text; string oldValue = selectedItem.SubItems[1].Text; using (EditVariableDialog dialog = new EditVariableDialog()) { dialog.ApplyParams(oldName, oldValue); if (dialog.ShowDialog(this) == DialogResult.OK) { string name = dialog.VariableName; string value = dialog.VariableValue; DeleteItem(oldName); DeleteItem(name); AddItem(name, value); } } }