Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
        /// <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);
            }
        }