Esempio n. 1
0
        /// <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 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);
            }
        }
        /// <summary>
        /// Adds a new test case.
        /// </summary>
        private void AddMI_Click(object sender, System.EventArgs e)
        {
            try
            {
                // create new item value.
                TsCHdaItemValue value = new TsCHdaItemValue();

                value.Value            = new Double();
                value.Timestamp        = RunTestDlg.BASETIME;
                value.Quality          = Da.TsCDaQuality.Good;
                value.HistorianQuality = OpcClientSdk.Hda.TsCHdaQuality.Raw;

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

                if (value == null)
                {
                    return;
                }

                // update display.
                AddItem(value, false);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Esempio n. 4
0
        /// <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          = Da.TsCDaQuality.Good;
                value.HistorianQuality = Hda.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);
            }
        }