/// <summary> /// Edits the parameters of s item time. /// </summary> private void EditMI_Click(object sender, System.EventArgs e) { try { // check for valid selection. if (timesLv_.SelectedItems.Count != 1) { return; } // create new item time. DateTime time = new ItemTimeEditDlg().ShowDialog((DateTime)timesLv_.SelectedItems[0].Tag); // prompt user to edit item time. if (time == DateTime.MinValue) { return; } // update display. UpdateListItem(timesLv_.SelectedItems[0], time); // adjust columns AdjustColumns(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
/// <summary> /// Adds a new item time. /// </summary> private void AddMI_Click(object sender, System.EventArgs e) { try { // prompt user to edit item time. DateTime time = new ItemTimeEditDlg().ShowDialog(RunTestDlg.Basetime); if (time == DateTime.MinValue) { return; } // get the current selection. int index = -1; if (timesLv_.SelectedIndices.Count > 0) { index = timesLv_.SelectedIndices[timesLv_.SelectedIndices.Count - 1]; } // update display. AddListItem(time, index); // adjust columns AdjustColumns(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }