static public void SaveAnswer(QAManagerData.QuestionAnswer questionAnswer) { RPlatform.ProjectsManager.projectInfo.QAData.questionAnswers[currentQAID] = questionAnswer; string timeStamp = RProxy.SimCoreClient.GetSimulatorLaunchTimeString('_'); string fileName = "SAGAT_" + timeStamp + ".xlsx"; string fileFullPath = RPlatform.ProjectsManager.projectInfo.QAData.questionAnswerSavePath; string fileFullName = Path.GetFullPath(fileFullPath + "\\" + fileName); //Create file try { FileInfo fileInfo = new FileInfo(fileFullName); if (!fileInfo.Exists) { Directory.CreateDirectory(fileFullPath); using (ExcelPackage package = new ExcelPackage(new FileStream(fileFullName, FileMode.Create))) { WriteExcel(package); } fileInfo = new FileInfo(fileFullName); } else { using (ExcelPackage package = new ExcelPackage(fileInfo)) { WriteExcel(package); } } } catch (Exception) { MessageBox.Show("SAGAT系统错误。\n详情:导出报表文件失败!", "SAGAT", MessageBoxButtons.OK, MessageBoxIcon.Error); }; }
static public void CheckWaitAnswer() { if (timerMode != TimerMode.WAIT_ANSWER) { return; } if (currentQASubItemID != -1 && currentSecondWaitAnswer / 10 >= currentQuestionAnswer.questionAnswerItems[currentQASubItemID].questionTimer) { if (currentQASubItemID >= currentQuestionAnswer.questionCount - 1) { currentAnsweredCount++; SaveAnswer(CloseQAFormEvent()); ContinueWaitPauseTimer(); currentQASubItemID = -1; currentQuestionAnswer = new QAManagerData.QuestionAnswer(); return; } else { //DoEvents currentQASubItemID++; currentSecondWaitAnswer = 0; ShowNextQuestionEvent(currentQASubItemID); } } }
static public void CheckWaitPause() { if (timerMode != TimerMode.WAIT_PAUSE) { return; } foreach (QAManagerData.QuestionAnswer questionAnswer in RPlatform.ProjectsManager.projectInfo.QAData.questionAnswers) { if (!questionAnswer.isDisplayed && currentTrackDistanceFromStart >= questionAnswer.pauseDistance) { currentQAID = RPlatform.ProjectsManager.projectInfo.QAData.questionAnswers.IndexOf(questionAnswer); RPlatform.ProjectsManager.projectInfo.QAData.questionAnswers[currentQAID].isDisplayed = true; PauseWaitPauseTimer(); //DoEvents if (questionAnswer.questionCount > 0) { currentQuestionAnswer = questionAnswer; currentQASubItemID = 0; new Thread((ThreadStart) delegate { Application.Run(new UserInterface.FromSAGAT()); }).Start(); ShowQAFormEvent(currentQuestionAnswer, currentQASubItemID); } else { ContinueWaitPauseTimer(); return; } break; } } }
static public QAManagerData.QuestionAnswer GetCurrentQuestion() { QAManagerData.QuestionAnswer retValue = new QAManagerData.QuestionAnswer(); try { if (timerMode == TimerMode.WAIT_ANSWER) { retValue = currentQuestionAnswer; } } catch (Exception) { }; return(retValue); }
static public QAManagerData.QuestionAnswer GetNextQuestion() { QAManagerData.QuestionAnswer retValue = new QAManagerData.QuestionAnswer(); try { if (timerMode == TimerMode.WAIT_PAUSE) { double distanceToQuestion = Double.MaxValue; foreach (QAManagerData.QuestionAnswer questionAnswer in RPlatform.ProjectsManager.projectInfo.QAData.questionAnswers) { if (!questionAnswer.isDisplayed && questionAnswer.pauseDistance - currentTrackDistanceFromStart >= 0 && distanceToQuestion > questionAnswer.pauseDistance - currentTrackDistanceFromStart) { distanceToQuestion = currentTrackDistanceFromStart - questionAnswer.pauseDistance; retValue = questionAnswer; } } } } catch (Exception) { }; return(retValue); }