/// <summary> /// Adds a new item value by copying an existing one. /// </summary> private void CopyMI_Click(object sender, System.EventArgs e) { try { // check for valid selection. if (ReadOnly || valuesLv_.SelectedItems.Count != 1) { return; } TsCHdaItemValue value = (TsCHdaItemValue)valuesLv_.SelectedItems[0].Tag; // create new item value. TsCHdaItemValue copy = new ItemValueEditDlg().ShowDialog((TsCHdaItemValue)value.Clone()); // prompt user to edit item value. if (copy == null) { return; } // update display. AddListItem(copy, valuesLv_.SelectedIndices[0]); // adjust columns AdjustColumns(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
/// <summary> /// Adds a new test case by copying an existing one. /// </summary> private void CopyMI_Click(object sender, System.EventArgs e) { try { // check for valid selection. if (ValuesLV.SelectedItems.Count != 1) { return; } TsCHdaItemValue value = (TsCHdaItemValue)ValuesLV.SelectedItems[0].Tag; // create new item value. TsCHdaItemValue copy = new ItemValueEditDlg().ShowDialog((TsCHdaItemValue)value.Clone()); // prompt user to edit test case. if (copy == null) { return; } // update display. AddItem(copy, false); } catch (Exception exception) { MessageBox.Show(exception.Message); } }