private void btnAdvanced_Click(object sender, EventArgs e)
 {
     try
     {
         string method = string.Empty;
         foreach (var c in grpInterpolation.Controls)
         {
             RadioButton r = c as RadioButton;
             if (r == null)
             {
                 continue;
             }
             if (r.Checked)
             {
                 method = r.Tag.ToString(); break;
             }
         }
         if (_monitorRollbackLine.MonitorAdvance == null)
         {
             _monitorRollbackLine.MonitorAdvance = new MonitorAdvance();
         }
         AdvancedOptions frm = new AdvancedOptions(method, _monitorRollbackLine.MonitorAdvance);
         frm.bcg       = _bgc;
         frm.mDataLine = _monitorRollbackLine;
         DialogResult rtn = frm.ShowDialog();
         if (rtn == DialogResult.OK)
         {
             _monitorRollbackLine.MonitorAdvance = frm.MyMonitorAdvance;
         }
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }
Esempio n. 2
0
        private void btnAdvanced_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            try
            {
                if (!((cboMonitorDataSet.Text != string.Empty && cboMonitorLibraryYear.Text != string.Empty) || txtMonitorDataFile.Text != string.Empty))
                {
                    msg = "Please select monitor dataset.";
                    MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                string method = string.Empty;
                foreach (var c in grpInterpolationMethod.Controls)
                {
                    RadioButton r = c as RadioButton;
                    if (r == null)
                    {
                        continue;
                    }
                    if (r.Checked)
                    {
                        method = r.Tag.ToString(); break;
                    }
                }
                if (_monitorAdvance == null)
                {
                    _monitorAdvance = new MonitorAdvance();
                }
                switch (cboMonitorType.SelectedIndex)
                {
                case 0:
                    _mDataLine.MonitorDirectType = 0;
                    if (cboMonitorDataSet.Text != string.Empty && cboMonitorLibraryYear.Text != string.Empty)
                    {
                        DataRowView drv  = cboMonitorDataSet.SelectedItem as DataRowView;
                        int         dsID = int.Parse(drv["MonitorDataSetID"].ToString());
                        _mDataLine.MonitorDataSetID = dsID;
                        drv = cboMonitorLibraryYear.SelectedItem as DataRowView;
                        _mDataLine.MonitorLibraryYear = int.Parse(drv["Yyear"].ToString());
                    }
                    else
                    {
                        msg = string.Format("Settings are not complete."); return;
                    }
                    _strPath = "Monitor data: library";
                    break;

                case 1:
                    _mDataLine.MonitorDirectType = 1;
                    if (txtMonitorDataFile.Text != string.Empty)
                    {
                        _mDataLine.MonitorDataFilePath = txtMonitorDataFile.Text;
                    }
                    else
                    {
                        msg = string.Format("Settings are not complete."); return;
                    }
                    _strPath = "Monitor data: " + txtMonitorDataFile.Text;
                    break;
                }
                AdvancedOptions frm = new AdvancedOptions(method, _monitorAdvance);
                frm.bcg       = _bgcMonitor;
                frm.mDataLine = _mDataLine;
                DialogResult rtn = frm.ShowDialog();
                if (rtn == DialogResult.OK)
                {
                    _monitorAdvance = frm.MyMonitorAdvance;
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }