private void RBtn_nextQuestion(EventArgs e) { if (this.QuestionNO == this.RSpiltQuestionNO) { this.PreInsertPosition = -1; if (this.RSpiltQuestionNO > 0) { this.Timer_Listening.Stop(); if (MessageBox.Show("You have finished all the questions in this passage, and you will go to the NEXT PASSAGE of this READING section.\nBut you CAN return to this passage again", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) == DialogResult.OK) { this.btn_stopReading_Click(new object(), e); this.ReadingPassageNo = 3; try { this.TRANSUI.Close(); this.EXP.Close(); } catch { } base.btn_continue.Visible = false; this.Timer_Listening.Start(); } } } #region temporarily disabled //this.SaveUserAnswers(); #endregion temporarily disabled if (this.HasReachedEndOfSection()) { if (this.PassageNO < this.PassageCount) { if (MessageBox.Show("You have seen all the questions in this part of the reading section.\nYou may go back and review your answers. As long as there is time remaining, you can check your work\n\nClick on Cancel to continue working.\nClick on OK to go on.\nOnce you leave this part of the reading section, you WILL NOT be able to return to it", "Finish Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK) { this.btn_stopReading_Click(new object(), e); this.ReadingPassageNo = 2; try { this.TRANSUI.Close(); this.EXP.Close(); } catch { } base.btn_continue.Visible = true; this.scoreReport(2); this.Timer_Listening.Stop(); this.PreInsertPosition = -1; this.PassageNO++; this.PartNO++; XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Reading\config.xml"); this.RSpiltQuestionNO = int.Parse(reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@spiltQuestionNO")); base.lbl_timeremain.Text = reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@time"); this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RDIRECTION; this.QuestionNO = 0; this.RMaterial = new TPOPassage(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\" + this.PassageNO.ToString() + ".txt").Substring(0xb5), RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\P" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); if (File.Exists(@"Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3") && ConstantValues.TPOEXPLANATION[this.TPONO]) { this.bn_readText.Visible = true; this.bn_readText.Enabled = true; } else { this.bn_readText.Visible = false; } this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\questions" + this.PassageNO.ToString() + ".txt").Substring(0xb5), "", RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\Q" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); this.QuestionCount = this.TestQuestions.QuestionCount; this.LoadReadingMaterialAndQA(); if (this.rb_PracticeMode.Checked && (MessageBox.Show("Do you want to load the answers you saved last time?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK)) { this.LoadUserAnswer(); } } } else if (MessageBox.Show("You have seen all the questions in the reading section.\nYou may go back and review your answers. As long as there is time remaining, you can check your work\n\nClick on Cancel to continue working.\nClick on OK to go on.\nOnce you leave the reading section, you WILL NOT be able to return to it", "Finish Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK) { this.btn_stopReading_Click(new object(), e); try { this.TRANSUI.Close(); this.EXP.Close(); } catch { } base.btn_continue.Visible = true; int num = this.TPONO % 10; if (num == 0) { num = 10; } this.btn_LoadTest_Click(this.BtnLoadTest[10 + num], e); this.PartNO = 1; this.PassageNO = 1; this.QuestionNO = 0; } } else { this.QuestionNO++; this.LoadReadingMaterialAndQA(); } }
private void Timer_Listening_Tick(object sender, EventArgs e) { DateTime time6; TimeSpan span; this.Timer_Listening.Interval = 0x3e8; int currentPosition = 0; if (this.TestSection == TestingSection.LISTENING) { currentPosition = this.MP3Player.CurrentPosition; } this.tb_currentpos.Value = currentPosition; this.pb_currentpos.Value = currentPosition; this.tb_currentpos1.Value = currentPosition; this.pb_currentpos1.Value = currentPosition; DateTime time = DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null); if (time < DateTime.ParseExact("00:01", "mm:ss", null)) { this.Timer_Listening.Stop(); this.SaveUserAnswers(); if (this.TestSection == TestingSection.LISTENING) { MessageBox.Show("Time over!", "Warning", MessageBoxButtons.OK); this.PartNO++; if (this.PartNO > this.PartCount) { this.PartNO = 0; this.PassageNO = 0; this.QuestionNO = 0; this.TestSection = TestingSection.SPEAKING; this.btn_LoadTest_Click(new Button(), e); } else { this.scoreReport(2); this.PassageNO = 4; this.QuestionNO = 0x11; this.btn_LoadTest_Click(new Button(), e); } return; } if (this.TestSection == TestingSection.READING) { MessageBox.Show("Time over!", "Warning", MessageBoxButtons.OK); this.PassageNO++; if (this.PassageNO <= this.PassageCount) { this.scoreReport(2); this.PreInsertPosition = -1; XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Reading\config.xml"); this.RSpiltQuestionNO = int.Parse(reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@spiltQuestionNO")); base.lbl_timeremain.Text = reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@time"); this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RDIRECTION; this.QuestionNO = 0; this.RMaterial = new TPOPassage(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\" + this.PassageNO.ToString() + ".txt").Substring(0xb5), RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\P" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); if (File.Exists(@"Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3") && ConstantValues.TPOEXPLANATION[this.TPONO]) { this.bn_readText.Visible = true; this.bn_readText.Enabled = true; } else { this.bn_readText.Visible = false; } this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\questions" + this.PassageNO.ToString() + ".txt").Substring(0xb5), "", RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\Q" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); this.QuestionCount = this.TestQuestions.QuestionCount; this.LoadReadingMaterialAndQA(); } else { int num2 = this.TPONO % 10; if (num2 == 0) { num2 = 10; } this.btn_LoadTest_Click(this.BtnLoadTest[10 + num2], e); this.PartNO = 1; this.PassageNO = 1; this.QuestionNO = 0; } } } if (time < DateTime.ParseExact("05:00", "mm:ss", null)) { base.button1.Visible = false; base.lbl_timeremain.Visible = true; this.flash_timer.Start(); } if (time < DateTime.ParseExact("04:45", "mm:ss", null)) { this.flash_timer.Stop(); base.lbl_timeremain.ForeColor = Color.Red; } if (this.TestSection == TestingSection.LISTENING) { int num4; if (this.IsPassageMP3) { if (this.rb_PracticeMode.Checked) { this.ckb_viewSpeakingText.Visible = true; } int length = this.SPictureTimeLines.Length; DateTime time2 = DateTime.ParseExact(this.MP3Player.CurrentPosStr, "mm:ss", null); if (length == 1) { this.pb_ListenScene.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[0]); this.pb_ListenScene1.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[0]); } else { for (num4 = 1; num4 < length; num4++) { DateTime time3 = DateTime.ParseExact(this.SPictureTimeLines[num4 - 1], "mm:ss", null); DateTime time4 = DateTime.ParseExact(this.SPictureTimeLines[num4], "mm:ss", null); if ((time3 <= time2) && (time2 <= time4)) { this.pb_ListenScene.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[num4 - 1]); this.pb_ListenScene1.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[num4 - 1]); } } DateTime time5 = DateTime.ParseExact(this.SPictureTimeLines[length - 1], "mm:ss", null); if (time2 > time5) { this.pb_ListenScene.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[length - 1]); this.pb_ListenScene1.Load(Application.StartupPath + @"\Tests\images\" + this.SPicturePaths[length - 1]); } } } else { this.ckb_viewSpeakingText.Visible = false; } if (this.rb_TestMode.Checked && ((this.MP3Player.CurrentPosition + 1) < this.MP3Player.Duration)) { base.btn_preQuestion.Enabled = false; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("ok"); } if (this.MP3Player.CurrentPosition < this.MP3Player.Duration) { this.ckb_ShowAnswer.Visible = false; } else { if (!this.HasClickedNext) { base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); } if (this.rb_PracticeMode.Checked) { this.ckb_ShowAnswer.Visible = true; } if (this.QuestionNO > 0) { time6 = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time6); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); } if (this.QuestionNO >= 1) { Question question = (Question)this.TestQuestions.Questions[this.QuestionNO - 1]; switch (question.QuestionType) { case QuestionType.TABEL: if (!this.ckb_ShowAnswer.Checked) { this.lbl_tableAnswer.Visible = false; break; } this.lbl_tableAnswer.Visible = true; this.lbl_tableAnswer.Text = question.RightAnswersStr; break; case QuestionType.SORT: if (question.QuestionType == QuestionType.SORT) { this.rtb_sumQuestion.Rtf = question.QuestionTitle; this.rtb_sumQuestion.Visible = true; num4 = 0; while ((num4 < question.Answer.Length) && (num4 < this.CkbSummary.Length)) { this.RtbSumAnswersToBeSelected[num4].Visible = true; this.CkbSummary[num4].Visible = true; this.RtbSumAnswersToBeSelected[num4].Rtf = (question.Answer[num4]).ToString(); num4++; } for (num4 = 0; num4 < question.RightAnswers.Length; num4++) { this.RtbSumSelected[num4].Visible = true; } this.Timer_Listening.Stop(); } break; default: for (num4 = 0; (num4 < question.Answer.Length) && (num4 < this.CkbReading.Length); num4++) { this.LRtbAnswers[num4].Visible = true; this.LCkbAnswers[num4].Visible = true; this.LRtbAnswers[num4].Rtf = (question.Answer[num4]).ToString(); } break; } if (this.IsQuestionAfter) { this.tabf_Listening.SelectedIndex = LQUESTIONS; this.LoadListeningQA(); this.IsQuestionAfter = false; } } } } if ((this.TestSection == TestingSection.READING) && (this.CurrentReadingStep >= 1)) { time6 = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time6); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); } }
private void btn_LoadTest_Click(object sender, EventArgs e) { this.rtb_writinganswers.Text = ""; try { for (int i = 1; i < 0x1c; i++) { string path = @"users\" + USERNAME + @"\" + i.ToString(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } this.InitialParas(); this.flash_timer.Stop(); Button button = (Button)sender; string name = button.Name; if (name.Contains("Reading")) { this.TestSection = TestingSection.READING; } if (name.Contains("Listening")) { this.TestSection = TestingSection.LISTENING; } if (name.Contains("Speaking")) { this.TestSection = TestingSection.SPEAKING; } if (name.Contains("Writing")) { this.TestSection = TestingSection.WRITING; } if (name.Contains("Review")) { this.TestSection = TestingSection.REVIEW; } if (name.Contains("Answer")) { this.TestSection = TestingSection.VIEWANSWERS; } if (this.TPONO <= 0) { this.TPONO = Convert.ToInt16(name.Substring(name.Length - 2)) + ((this.CurrentTPOPage - 1) * 10); } if (this.PartNO <= 0) { this.PartNO = 1; } if (this.PassageNO <= 0) { this.PassageNO = 1; } if (!ConstantValues.TPOACTIVED[this.TPONO]) { if (MessageBox.Show("The TPO" + this.TPONO.ToString() + " is not actived yet, Do you want to buy the product?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.OK) { Process.Start("http://item.taobao.com/item.htm?id=12627161348"); new RegisterForm().Show(); } this.TPONO = 0; this.PartNO = 0; this.PassageNO = 0; this.QuestionNO = 0; } else if (this.CheckFileConsistence()) { base.btn_continue.Enabled = true; base.btn_continue.Visible = true; this.BottonsStatus(); this.rb_PracticeMode.Visible = false; this.rb_TestMode.Visible = false; if (this.rb_PracticeMode.Checked) { base.lbl_mode.Text = "PRACTICE MODE"; } else { base.lbl_mode.Text = "TEST MODE"; } XMLFileReader reader = new XMLFileReader(); switch (this.TestSection) { case TestingSection.READING: this.Timer_Listening.Start(); this.lbl_testingSection.Visible = true; this.lbl_testingSection.Text = "Reading Section"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; base.lbl_timeremain.Text = "20:00"; this.ReadingPassageNo = 1; this.QuestionNO = 0; this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RDIRECTION; reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Reading\config.xml"); this.RSpiltQuestionNO = int.Parse(reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@spiltQuestionNO")); this.PassageCount = int.Parse(reader.GetAttr("//@passageCount")); base.lbl_timeremain.Text = reader.GetAttr("//Passage[@NO=" + this.PassageNO + "]/@time"); this.RMaterial = new TPOPassage(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\" + this.PassageNO.ToString() + ".txt").Substring(0xb5), RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\P" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); if (!File.Exists(@"Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3") || !ConstantValues.TPOEXPLANATION[this.TPONO]) { goto Label_0597; } this.bn_readText.Visible = true; this.bn_readText.Enabled = true; goto Label_05A6; case TestingSection.LISTENING: { this.lbl_testingSection.Visible = true; base.btn_nextQuestion.Enabled = false; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next"); base.btn_preQuestion.Enabled = false; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("ok"); base.lbl_timeremain.ForeColor = SystemColors.ControlText; base.lbl_timeremain.Text = "10:00"; this.lbl_testingSection.Text = "Listening Section"; reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Listening\questions.xml"); this.PartCount = int.Parse(reader.GetAttr("//parts/@partCount")); string attr = reader.GetAttr("//passage[@NO=" + 2 + "]/pictures/picture/@pictureName"); base.lbl_timeremain.Text = reader.GetAttr("//part[@NO=" + this.PartNO + "]/@timeLimitation"); this.TimeLimitation = DateTime.ParseExact(reader.GetAttr("//part[@NO=" + this.PartNO + "]/@timeLimitation"), "mm:ss", null); this.QuestionCount = int.Parse(reader.GetAttr("//part[@NO=" + this.PartNO + "]/@questionCount")); this.tabf_test.SelectedIndex = LISTENING; this.tabf_Listening.SelectedIndex = LDIRECTION1; if (this.PassageNO <= 1) { this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Listening\questions.rtf"), @"Tests\" + this.TPONO.ToString() + @"\Listening\questions.xml", ""); } string str4 = reader.GetAttr("//part[@NO=" + this.PartNO + "]/@partDirection"); try { this.MP3Player = new MP3MCI(); string str5 = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", str4 }); this.MP3Player.FileName = str5; this.PlayFileName.Text = str5; this.pb_currentpos.Maximum = this.MP3Player.Duration; this.pb_currentpos1.Maximum = this.MP3Player.Duration; this.tb_currentpos.Maximum = this.MP3Player.Duration; this.tb_currentpos1.Maximum = this.MP3Player.Duration; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.Timer_Listening.Start(); } catch { MessageBox.Show("open出错!"); } break; } case TestingSection.SPEAKING: this.lbl_testingSection.Visible = true; this.lbl_testingSection.Text = "Speaking Section"; base.btn_nextQuestion.Visible = false; base.btn_preQuestion.Visible = false; this.LoadSpeakingQuestion(); this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SDIRECTION; this.QuestionNO = 1; this.CurrentSpeakingStep = 0; this.Timer_Speaking.Start(); break; case TestingSection.WRITING: this.Timer_Listening.Start(); this.lbl_testingSection.Visible = true; base.btn_nextQuestion.Enabled = false; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next"); base.lbl_timeremain.ForeColor = SystemColors.ControlText; base.lbl_timeremain.Text = "03:00"; this.lbl_testingSection.Text = "Writing Section"; base.lbl_questionNO.Text = "Question 1 of 2"; this.LoadWritingQuestion(); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WDIRECTION; this.CurrentWritingStep = 0; this.Timer_Speaking.Start(); break; case TestingSection.REVIEW: { this.rb_TestMode.Checked = true; int index = this.TPONO % 10; if (index == 0) { index = 10; } this.btn_LoadTest_Click(this.BtnLoadTest[index], e); break; } case TestingSection.VIEWANSWERS: base.btn_continue.Visible = false; this.ReportingScores(); this.tabf_test.SelectedIndex = USERANSWERS; this.btn_NexPage.Visible = false; this.btn_LastPage.Visible = false; base.btn_mainmenu.Visible = true; break; } } return; Label_0597: this.bn_readText.Visible = false; Label_05A6: ; this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO.ToString() + @"\Reading\questions" + this.PassageNO.ToString() + ".txt").Substring(0xb5), "", RtfReader.getRTF(@"Explanations\" + this.TPONO.ToString() + @"\Reading\Q" + this.PassageNO.ToString() + ".txt").Substring(0xb5)); this.QuestionCount = this.TestQuestions.QuestionCount; this.LoadReadingMaterialAndQA(); if (this.rb_PracticeMode.Checked && (MessageBox.Show("Do you want to load the answers you saved last time?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.OK)) { this.LoadUserAnswer(); } } catch (Exception exception) { MessageBox.Show(exception.StackTrace); } }