Ejemplo n.º 1
0
        /// <summary>
        /// Occurs when OK button is clicked.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">EventArgs</param>
        private void BtnOK_Click(object sender, EventArgs e)
        {
            string errorMessage = string.Empty;

            errorMessage  = _panel.UpdateParameter();
            errorMessage += ValidateParameters();

            if (errorMessage != string.Empty)
            {
                MessageBox.Show(errorMessage, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            //if thread is already exists, abort it.
            if (_threadCal != null)
            {
                _threadCal.Abort();
                _threadCal = null;
            }

            //Save parameters.
            _resamplingParam.WriteParameterIni();
            _baselineParam.WriteParameterIni();

            //Prepare to calculate.
            //Create thread for dialog.
            _threadCal          = new System.Threading.Thread(ThreadCalc);
            _threadCal.Priority = System.Threading.ThreadPriority.Lowest;

            //Create dialog.
            if (_dlgProgress == null)
            {
                _dlgProgress = new ProgressDlg();
                _dlgProgress.CancelEnabled = true;
                _dlgProgress.PrgCancel    += DlgProgress_PrgCancel;
                _calculate.UpdateProgress += UpdateRemoveCalcProgress;
                _calculate.UpdateResamplingProgressTemp += UpdateSpecCalcResamplingProgress;
            }

            //Start calculate.
            _threadCal.Start();
            _dlgProgress.ShowDialog();

            _calculate.UpdateResamplingProgressTemp -= UpdateSpecCalcResamplingProgress;
            _dlgProgress = null;


            if (_calculate.Result != null)
            {
                _calculate.SubmitResultToTree();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Occurs when OK button is clicked.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">EventArgs</param>
        private void BtnOK_Click(object sender, EventArgs e)
        {
            string errorMessage;

            errorMessage = _panel.UpdateParameter();

            if (errorMessage != string.Empty)
            {
                MessageBox.Show(errorMessage, "Invalid Parameter", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            _resamplingParameter.WriteParameterIni();
            this.Close();
        }