private void buttonCustomCommandAdd_Click(object sender, EventArgs e) { CustomCommandForm customCommandForm = new CustomCommandForm(); if (customCommandForm.ShowDialog(this) == DialogResult.OK) { this.listViewCustomCommand.Items.Add(new ListViewItem(new string[] { customCommandForm.Name, customCommandForm.Command })); this.listViewCustomCommand.EnsureVisible(this.listViewCustomCommand.Items.Count - 1); } }
private void ListViewCustomCommand_DoubleClick(object sender, EventArgs e) { if (!this._editable) { return; } if (this.listViewCustomCommand.SelectedItems.Count > 0) { ListViewItem listViewItem = this.listViewCustomCommand.SelectedItems[0]; CustomCommandForm customCommandForm = new CustomCommandForm(listViewItem.SubItems[0].Text, listViewItem.SubItems[1].Text); if (customCommandForm.ShowDialog() == DialogResult.OK) { listViewItem.SubItems[0].Text = customCommandForm.Name; listViewItem.SubItems[1].Text = customCommandForm.Command; } } }