/// <summary>
        /// Edits the parameters of s item value.
        /// </summary>
        private void EditMI_Click(object sender, System.EventArgs e)
        {
            try
            {
                // check for valid selection.
                if (ReadOnly || valuesLv_.SelectedItems.Count != 1)
                {
                    return;
                }

                // create new item value.
                TsCHdaItemValue value = new ItemValueEditDlg().ShowDialog((TsCHdaItemValue)valuesLv_.SelectedItems[0].Tag);

                // prompt user to edit item value.
                if (value == null)
                {
                    return;
                }

                // update display.
                UpdateListItem(valuesLv_.SelectedItems[0], value);

                // adjust columns
                AdjustColumns();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        /// <summary>
        /// Adds a new item value.
        /// </summary>
        private void AddMI_Click(object sender, System.EventArgs e)
        {
            try
            {
                // check control state.
                if (ReadOnly)
                {
                    return;
                }

                // create new item value.
                TsCHdaItemValue value = new TsCHdaItemValue();

                value.Value            = new Double();
                value.Timestamp        = RunTestDlg.Basetime;
                value.Quality          = TsCDaQuality.Good;
                value.HistorianQuality = TsCHdaQuality.Raw;

                // prompt user to edit item value.
                value = new ItemValueEditDlg().ShowDialog(value);

                if (value == null)
                {
                    return;
                }

                // get the current selection.
                int index = -1;

                if (valuesLv_.SelectedIndices.Count > 0)
                {
                    index = valuesLv_.SelectedIndices[valuesLv_.SelectedIndices.Count - 1];
                }

                // update display.
                AddListItem(value, index);

                // adjust columns
                AdjustColumns();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }