예제 #1
0
파일: MainForm.cs 프로젝트: ming91915/SDSS
        /// <summary> 计算完成,开始后处理 </summary>
        private void _backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            OnSdCalculationFinished();
            AnsysSolver solver = _bcParameters.Solver;

            //
            if (e.Cancelled) // 判断是否是手动退出线程
            {
                // 说明
                // solver.State = SolverState.FailedInCs;
            }

            // 后处理
            StringBuilder sb = new StringBuilder();

            _PostProcessor = new PostProcessor(Model, solver);
            if (_PostProcessor.CheckFinishState(errorMessage: ref sb))
            {
                SolverState ss = _PostProcessor.CheckOutputFiles(errorMessage: ref sb);
                if (ss == SolverState.Succeeded)
                {
                    if (Options.DirectlyReport)
                    {
                        ReadAndShowResults();
                    }
                    else
                    {
                        var res = MessageBox.Show(@"计算结束且成功,是否直接生成报告?", @"Congratulations", MessageBoxButtons.OKCancel,
                                                  MessageBoxIcon.Asterisk);
                        if (res == DialogResult.OK)
                        {
                            ReadAndShowResults();
                        }
                    }
                }
                else if (ss == SolverState.FailedWithError)
                {
                    var res = MessageBox.Show("Ansys 计算结束!\r\n" + sb.ToString(), @"提示", MessageBoxButtons.OK,
                                              MessageBoxIcon.Error);
                }
            }
            else
            {
                var res = MessageBox.Show("Ansys 计算过程未正常结束!\r\n" + sb.ToString(), @"提示", MessageBoxButtons.OK,
                                          MessageBoxIcon.Error);
            }
        }