private void ButtonNewScan_Click(object sender, EventArgs e)
        {
            OptionSub3From optionSub3From = new OptionSub3From();

            if (optionSub3From.ShowDialog(this) == DialogResult.OK)
            {
                TriggerInfos.TriggerInfo triggerInfo = optionSub3From.GetTriggerInfo();

                ListViewItem listViewItem = new ListViewItem(triggerInfo.m_strTriggerName);

                ListViewItem.ListViewSubItem listViewSubItem = new ListViewItem.ListViewSubItem(listViewItem, triggerInfo.m_strStockFile);
                listViewItem.SubItems.Add(listViewSubItem);

                ListViewItem.ListViewSubItem listViewSubItem2 = new ListViewItem.ListViewSubItem(listViewItem, triggerInfo.m_strOpenSRFile);
                listViewItem.SubItems.Add(listViewSubItem2);

                ListViewItem.ListViewSubItem listViewSubItem3 = new ListViewItem.ListViewSubItem(listViewItem, triggerInfo.m_strOpenUTMR_DTMSFile);
                listViewItem.SubItems.Add(listViewSubItem3);

                m_TriggerInfos.Add(listViewItem, triggerInfo);
                m_AddTriggerInfos.Add(listViewItem, triggerInfo);
                this.ListViewScan.Items.Add(listViewItem);

                if (ButtonSaveChanged != null)
                {
                    ButtonSaveChanged(this, EventArgs.Empty);
                }
            }
        }
        private void ListViewScan_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Clicks == 2 && e.Button == MouseButtons.Left)
            {
                ListViewHitTestInfo listViewHitTestInfo = this.ListViewScan.HitTest(this.ListViewScan.PointToClient(Cursor.Position));

                if (listViewHitTestInfo == null)
                {
                    return;
                }

                if (listViewHitTestInfo.Item == null)
                {
                    return;
                }

                if (this.ListViewScan.SelectedItems.Contains(listViewHitTestInfo.Item) == false)
                {
                    return;
                }

                if (listViewHitTestInfo.Location != ListViewHitTestLocations.Label)
                {
                    return;
                }

                TriggerInfos.TriggerInfo triggerInfo = null;
                if (m_TriggerInfos.TryGetValue(listViewHitTestInfo.Item, out triggerInfo) == true)
                {
                    OptionSub3From optionSub3From = new OptionSub3From();
                    optionSub3From.SetTriggerInfo(triggerInfo);

                    if (optionSub3From.ShowDialog(this) == DialogResult.OK)
                    {
                        triggerInfo = optionSub3From.GetTriggerInfo();

                        listViewHitTestInfo.Item.Text = triggerInfo.m_strTriggerName;

                        listViewHitTestInfo.Item.SubItems[1].Text = triggerInfo.m_strStockFile;
                        listViewHitTestInfo.Item.SubItems[2].Text = triggerInfo.m_strOpenSRFile;
                        listViewHitTestInfo.Item.SubItems[3].Text = triggerInfo.m_strOpenUTMR_DTMSFile;

                        m_TriggerInfos[listViewHitTestInfo.Item] = triggerInfo;
                    }
                }
            }
        }
        public TriggerInfos GetTriggerInfos()
        {
            TriggerInfos triggerInfos = new TriggerInfos();

            triggerInfos.m_AllowTrigger = this.CheckBoxScan.Checked;


            List <TriggerInfos.TriggerInfo> triggerInfoList = new List <TriggerInfos.TriggerInfo>();

            for (int iIndex = 0; iIndex < this.ListViewScan.Items.Count; iIndex++)
            {
                ListViewItem listViewItem = this.ListViewScan.Items[iIndex];

                TriggerInfos.TriggerInfo triggerInfo = null;
                if (m_TriggerInfos.TryGetValue(listViewItem, out triggerInfo) == true)
                {
                    triggerInfoList.Add(triggerInfo);
                }
            }

            triggerInfos.m_TriggerInfos = triggerInfoList.ToArray();

            return(triggerInfos);
        }
        public TriggerInfos.TriggerInfo GetTriggerInfo()
        {
            TriggerInfos.TriggerInfo triggerInfo = new TriggerInfos.TriggerInfo();

            triggerInfo.m_strTriggerName       = m_OptionControlSub3FromA.TextBoxName.Text;
            triggerInfo.m_strStockFile         = m_OptionControlSub3FromA.TextBoxStockList.Text;
            triggerInfo.m_strOpenSRFile        = m_OptionControlSub3FromA.TextBoxSRFile.Text;
            triggerInfo.m_strOpenUTMR_DTMSFile = m_OptionControlSub3FromA.TextBoxSaveUTMR_DTMSFile.Text;
            triggerInfo.m_strSaveSRFile        = m_OptionControlSub3FromA.TextBoxSaveSRFile.Text;
            triggerInfo.m_strSaveUTMR_DTMSFile = m_OptionControlSub3FromA.TextBoxSaveUTMR_DTMSFile.Text;
            triggerInfo.m_AllowUTMR_DTMS       = m_OptionControlSub3FromA.CheckBoxUTMR_DTMS.Checked;

            triggerInfo.m_AllowTrigger = m_OptionControlSub3FromB.CheckBoxTrigger.Checked;

            switch (m_OptionControlSub3FromB.comboBoxTask.SelectedIndex)
            {
            case 0:

                triggerInfo.m_TriggerTask = TriggerInfos.TriggerTask.Tasking;

                break;

            default:

                triggerInfo.m_TriggerTask = TriggerInfos.TriggerTask.Tasking;

                break;
            }

            if (m_OptionControlSub3FromB.RadioButtonOne.Checked)
            {
                triggerInfo.m_TriggerDate = TriggerInfos.TriggerDate.DateOne;
            }
            else if (m_OptionControlSub3FromB.RadioButtonDay.Checked)
            {
                triggerInfo.m_TriggerDate = TriggerInfos.TriggerDate.DateDay;
            }
            else if (m_OptionControlSub3FromB.RadioButtonWeek.Checked)
            {
                triggerInfo.m_TriggerDate = TriggerInfos.TriggerDate.DateWeek;
            }
            else if (m_OptionControlSub3FromB.RadioButtonMonth.Checked)
            {
                triggerInfo.m_TriggerDate = TriggerInfos.TriggerDate.DateMonth;
            }
            else
            {
                triggerInfo.m_TriggerDate = TriggerInfos.TriggerDate.DateDay;
            }

            triggerInfo.DateDay_TimeSpan = (int)m_OptionControlSub3FromB.m_OptionControlSub3FromBSub2.numericUpDown.Value;

            triggerInfo.m_DateTimeBegin = m_OptionControlSub3FromB.dateTimePickerBegin.Value.Date + m_OptionControlSub3FromB.dateTimePickerTimeBegin.Value.TimeOfDay;

            triggerInfo.m_AllowSpan        = m_OptionControlSub3FromB.checkBoxSpace.Checked;
            triggerInfo.m_TimeSpanSpan     = m_OptionControlSub3FromB.dateTimePickerSpace.Value;
            triggerInfo.m_TimeSpanSpanTime = m_OptionControlSub3FromB.dateTimePickerSpaceTime.Value;

            triggerInfo.m_AllowSpanRun = m_OptionControlSub3FromB.checkBoxRun.Checked;
            triggerInfo.m_TimeSpanRun  = m_OptionControlSub3FromB.dateTimePickerRun.Value;

            triggerInfo.m_AllowEnd    = m_OptionControlSub3FromB.checkBoxEnd.Checked;
            triggerInfo.m_DateTimeEnd = m_OptionControlSub3FromB.dateTimePickerEnd.Value.Date + m_OptionControlSub3FromB.dateTimePickerTimeEnd.Value.TimeOfDay;

            return(triggerInfo);
        }
        public void SetTriggerInfo(TriggerInfos.TriggerInfo triggerInfo)
        {
            m_OptionControlSub3FromA.TextBoxName.Text              = triggerInfo.m_strTriggerName;
            m_OptionControlSub3FromA.TextBoxStockList.Text         = triggerInfo.m_strStockFile;
            m_OptionControlSub3FromA.TextBoxSRFile.Text            = triggerInfo.m_strOpenSRFile;
            m_OptionControlSub3FromA.TextBoxSaveUTMR_DTMSFile.Text = triggerInfo.m_strOpenUTMR_DTMSFile;
            m_OptionControlSub3FromA.TextBoxSaveSRFile.Text        = triggerInfo.m_strSaveSRFile;
            m_OptionControlSub3FromA.TextBoxSaveUTMR_DTMSFile.Text = triggerInfo.m_strSaveUTMR_DTMSFile;
            m_OptionControlSub3FromA.CheckBoxUTMR_DTMS.Checked     = triggerInfo.m_AllowUTMR_DTMS;


            m_OptionControlSub3FromB.CheckBoxTrigger.Checked = triggerInfo.m_AllowTrigger;

            switch (triggerInfo.m_TriggerTask)
            {
            case TriggerInfos.TriggerTask.Tasking:

                m_OptionControlSub3FromB.comboBoxTask.SelectedIndex = 0;

                break;

            default:

                m_OptionControlSub3FromB.comboBoxTask.SelectedIndex = 0;

                break;
            }

            if (triggerInfo.m_TriggerDate == TriggerInfos.TriggerDate.DateOne)
            {
                m_OptionControlSub3FromB.RadioButtonOne.Checked = true;
            }
            else if (triggerInfo.m_TriggerDate == TriggerInfos.TriggerDate.DateDay)
            {
                m_OptionControlSub3FromB.RadioButtonDay.Checked = true;
            }
            else if (triggerInfo.m_TriggerDate == TriggerInfos.TriggerDate.DateWeek)
            {
                m_OptionControlSub3FromB.RadioButtonWeek.Checked = true;
            }
            else if (triggerInfo.m_TriggerDate == TriggerInfos.TriggerDate.DateMonth)
            {
                m_OptionControlSub3FromB.RadioButtonMonth.Checked = true;
            }
            else
            {
                m_OptionControlSub3FromB.RadioButtonDay.Checked = true;
            }

            m_OptionControlSub3FromB.m_OptionControlSub3FromBSub2.numericUpDown.Value = triggerInfo.DateDay_TimeSpan;

            m_OptionControlSub3FromB.dateTimePickerBegin.Value     = triggerInfo.m_DateTimeBegin.Date;
            m_OptionControlSub3FromB.dateTimePickerTimeBegin.Value = triggerInfo.m_DateTimeBegin;

            m_OptionControlSub3FromB.checkBoxSpace.Checked         = triggerInfo.m_AllowSpan;
            m_OptionControlSub3FromB.dateTimePickerSpace.Value     = triggerInfo.m_TimeSpanSpan;
            m_OptionControlSub3FromB.dateTimePickerSpaceTime.Value = triggerInfo.m_TimeSpanSpanTime;

            m_OptionControlSub3FromB.checkBoxRun.Checked     = triggerInfo.m_AllowSpanRun;
            m_OptionControlSub3FromB.dateTimePickerRun.Value = triggerInfo.m_TimeSpanRun;

            m_OptionControlSub3FromB.checkBoxEnd.Checked         = triggerInfo.m_AllowEnd;
            m_OptionControlSub3FromB.dateTimePickerEnd.Value     = triggerInfo.m_DateTimeEnd.Date;
            m_OptionControlSub3FromB.dateTimePickerTimeEnd.Value = triggerInfo.m_DateTimeEnd;
        }