private void Timer_Speaking_Tick(object sender, EventArgs e) { DateTime time = new DateTime(); DateTime time2 = new DateTime(); TimeSpan span = new TimeSpan(); DateTime time3 = new DateTime(); string str = ""; if (this.TestSection != TestingSection.SPEAKING) { if (this.TestSection == TestingSection.WRITING) { switch (this.CurrentWritingStep) { case 0: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WDIRECTION; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\writeA1.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.HasLoadMP3 = true; } catch { } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 1; this.HasLoadMP3 = false; } break; case 1: if (!this.HasLoadMP3) { try { base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WSPEECH; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\writeA2.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.pb_writingScene.Load(Application.StartupPath + @"\Tests\images\WaitPerson.jpg"); this.wpb_speak.Maximum = this.MP3Player.Duration; this.wtb_speak.Maximum = this.MP3Player.Duration; this.HasLoadMP3 = true; } catch { } } this.wpb_speak.Value = this.MP3Player.CurrentPosition; this.wtb_speak.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 2; this.HasLoadMP3 = false; } break; case 2: if (!this.HasLoadMP3) { base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); base.btn_preQuestion.Enabled = false; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back"); this.MP3Player.StopT(); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; this.wrtb_writing2.ReadOnly = true; this.wrtbQuestion2.Rtf = this.WritingQuestions[0]; base.lbl_timeremain.Text = "03:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.CurrentWritingStep = 3; this.HasLoadMP3 = false; } break; case 3: if (!this.HasLoadMP3) { try { if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WSPEECH; this.MP3Player = new MP3MCI(); base.lbl_timeremain.Text = "20:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; str = @"Tests\" + this.TPONO + @"\Writing\Speech.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.wpb_speak.Maximum = this.MP3Player.Duration; this.wtb_speak.Maximum = this.MP3Player.Duration; this.pb_writingScene.Load(Application.StartupPath + @"\Tests\images\write" + this.TPONO.ToString() + ".jpg"); this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } this.wpb_speak.Value = this.MP3Player.CurrentPosition; this.wtb_speak.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 4; this.HasLoadMP3 = false; } break; case 4: if (!this.HasLoadMP3) { try { if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\writeA3.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.wrtb_writing2.ReadOnly = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } this.wpb_speak.Value = this.MP3Player.CurrentPosition; this.wtb_speak.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentWritingStep = 5; this.HasLoadMP3 = false; } break; case 5: if (!this.HasLoadMP3) { if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } base.btn_nextQuestion.Enabled = true; base.btn_nextQuestion.BackgroundImage = (Image)this.resmgr.GetObject("next1"); this.MP3Player.StopT(); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; base.lbl_questionNO.Text = "Question 1 of 2"; this.wrtbQuestion2.Rtf = this.WritingQuestions[0]; this.wrtb_writing2.ReadOnly = false; this.lbl_writeDirection.Text = "Directions: You have 20 minutes to plan and write your response. Your response will be judged on the basis of the quality of your writing and on how well your response presents in the lecture and their relationship to the reading passage. Typically, an effective response will be 150 to 225 words.\n Question: Summarize the points made in the lecture, being sure to explain how they cast doubt on specific points made in the reading passage."; base.lbl_timeremain.Text = "20:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); time3 = DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null); this.WriteWritingAnswers("write1.txt", this.wrtb_writing2.Text); if (time3 <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.Timer_Speaking.Stop(); if (MessageBox.Show("Time over", "Warning", MessageBoxButtons.OK) == DialogResult.OK) { this.Timer_Speaking.Start(); } this.CurrentWritingStep = 6; this.HasLoadMP3 = false; } break; case 6: if (!this.HasLoadMP3) { this.MP3Player.StopT(); if (this.rb_PracticeMode.Checked) { base.btn_preQuestion.Enabled = true; base.btn_preQuestion.BackgroundImage = (Image)this.resmgr.GetObject("back1"); } this.WriteWritingAnswers("write1.txt", this.wrtb_writing2.Text); this.tabf_test.SelectedIndex = WRITING; this.tabf_writing.SelectedIndex = WINDEPENDENT; this.lbl_writeDirection.Text = "Directions: Read the question below. You have 30 minutes to plan, write, and revise your essay. Typically, an effective response will contain a minimum of 300 words."; this.wrtb_writing2.Text = ""; this.wrtb_writing2.ReadOnly = false; this.wrtbQuestion2.Rtf = this.WritingQuestions[1]; base.lbl_questionNO.Text = "Question 2 of 2"; base.lbl_timeremain.Text = "30:00"; base.lbl_timeremain.ForeColor = SystemColors.ControlText; this.HasLoadMP3 = true; } this.WriteWritingAnswers("write2.txt", this.wrtb_writing2.Text); time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.WriteWritingAnswers("write2.txt", this.wrtb_writing2.Text); this.Timer_Speaking.Stop(); if (MessageBox.Show("Time over", "Warning", MessageBoxButtons.OK) == DialogResult.OK) { this.btn_mainmenu_Click(sender, e); } this.CurrentWritingStep = 6; this.HasLoadMP3 = false; } break; } } } else { XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Speaking\questions.xml"); string attr = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@SpeakingIntro"); string str3 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@SpeakingMP3"); string str4 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@ReadingMP3"); string str5 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@SpeakingQuestion"); string str6 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@BeepPrepare"); string str7 = reader.GetAttr("//question[@NO=" + this.QuestionNO + "]/@BeepSpeak"); switch (this.CurrentSpeakingStep) { case 0: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SDIRECTION; this.MP3Player = new MP3MCI(); str = @"Tests\Direction\Speaking_Introduction.mp3"; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.HasLoadMP3 = true; this.srtb_introduction.Rtf = this.SpeakingQuestions[this.QuestionNO - 1].ToString(); this.srtb_introduction.Visible = true; this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; this.spb.Visible = false; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 1; this.HasLoadMP3 = false; } break; case 1: if (this.CONTINUECLICKED) { if (!this.HasLoadMP3) { try { this.pb_speakingScene.Load(Application.StartupPath + @"\Tests\images\WaitPerson.jpg"); base.lbl_questionNO.Text = "Question " + this.QuestionNO + " of 6"; this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.pb_speakingScene.Visible = true; this.srtb_introduction.Visible = false; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", attr }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; this.spb.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { if ((((this.QuestionNO == 1) || (this.QuestionNO == 2)) || (this.QuestionNO == 5)) || (this.QuestionNO == 6)) { this.CurrentSpeakingStep = 4; } else if ((this.QuestionNO == 3) || (this.QuestionNO == 4)) { this.CurrentSpeakingStep = 2; } this.HasLoadMP3 = false; } } break; case 2: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str4 }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.pb_speakingScene.Visible = false; base.lbl_timeremain.Text = "00:45"; this.srtb_timeindicator.Text = "READING TIME"; this.srtb_introduction.Rtf = this.SReadingMaterials[this.QuestionNO - 3]; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_introduction.Visible = true; this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.spb.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 3; this.HasLoadMP3 = false; } break; case 3: if (!this.HasLoadMP3) { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.srtb_introduction.Rtf = this.SReadingMaterials[this.QuestionNO - 3]; this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; base.lbl_timeremain.Text = "00:45"; this.srtb_timeindicator.Text = "READING TIME"; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.spb.Visible = false; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); this.srtb_timeindicator.Text = "READING TIME"; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.CurrentSpeakingStep = 4; this.HasLoadMP3 = false; } break; case 4: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str3 }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.spb.Maximum = this.MP3Player.Duration; if (this.QuestionNO > 2) { this.spb.Visible = true; } else { this.spb.Visible = false; } this.srtb_introduction.Rtf = this.SpeakingQuestions[this.QuestionNO - 1]; if ((this.QuestionNO == 1) || (this.QuestionNO == 2)) { this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; } else { this.srtb_introduction.Visible = false; this.pb_speakingScene.Load(string.Concat(new object[] { Application.StartupPath, @"\Tests\images\speak", this.QuestionNO, ".jpg" })); this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; this.pb_speakingScene.Visible = true; } this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } this.spb.Value = this.MP3Player.CurrentPosition; if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { if ((this.QuestionNO == 1) || (this.QuestionNO == 2)) { this.CurrentSpeakingStep = 6; this.spb.Visible = false; base.lbl_timeremain.Text = "00:15"; this.srtb_timeindicator.Text = "PREPARATION TIME"; this.srtb_timeindicator.Visible = true; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_timer.Visible = true; } else { this.CurrentSpeakingStep = 5; } this.HasLoadMP3 = false; } break; case 5: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str5 }); this.spb.Visible = false; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_introduction.Rtf = this.SpeakingQuestions[this.QuestionNO - 1]; this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; if ((this.QuestionNO == 3) || (this.QuestionNO == 4)) { base.lbl_timeremain.Text = "00:30"; } else { base.lbl_timeremain.Text = "00:20"; } this.srtb_timeindicator.Text = "PREPARATION TIME"; this.srtb_timeindicator.Visible = true; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.srtb_timer.Visible = true; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 6; this.HasLoadMP3 = false; } break; case 6: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str6 }); this.spb.Visible = false; this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 7; this.HasLoadMP3 = false; } break; case 7: if (!this.HasLoadMP3) { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { if ((this.QuestionNO == 1) || (this.QuestionNO == 2)) { base.lbl_timeremain.Text = "00:45"; } else { base.lbl_timeremain.Text = "01:00"; } this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.srtb_timeindicator.Text = "RESPONSE TIME"; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; this.CurrentSpeakingStep = 8; this.HasLoadMP3 = false; } break; case 8: if (!this.HasLoadMP3) { try { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Player = new MP3MCI(); str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Speaking\", str7 }); this.MP3Player.FileName = str; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } catch { MessageBox.Show("open" + str + "出错!"); } } if (this.MP3Player.CurrentPosition >= this.MP3Player.Duration) { this.CurrentSpeakingStep = 9; this.HasLoadMP3 = false; } break; case 9: if (!this.HasLoadMP3) { this.tabf_test.SelectedIndex = SPEAKING; this.tabf_speaking.SelectedIndex = SQUESTION; this.MP3Recorder = new MP3Record(); this.MP3Recorder.SetFilePath(string.Concat(new object[] { @"users\", USERNAME, @"\", this.TPONO, @"\SpeakingAnswer", this.QuestionNO, ".wav" })); this.MP3Recorder.Start(); this.srtb_introduction.Visible = true; this.pb_speakingScene.Visible = false; this.HasLoadMP3 = true; } time = DateTime.ParseExact("00:01", "mm:ss", null); span = (TimeSpan)(DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) - time); base.lbl_timeremain.Text = span.Minutes.ToString().PadLeft(2, '0') + ":" + span.Seconds.ToString().PadLeft(2, '0'); this.srtb_timeindicator.Visible = true; this.srtb_timer.Visible = true; this.srtb_timer.Text = "00:" + base.lbl_timeremain.Text; if (DateTime.ParseExact(base.lbl_timeremain.Text.ToString(), "mm:ss", null) <= DateTime.ParseExact("00:00", "mm:ss", null)) { this.CurrentSpeakingStep = 10; this.MP3Recorder.Stop(); this.HasLoadMP3 = false; } break; case 10: if (!this.HasLoadMP3) { if (this.QuestionNO >= 6) { this.TestSection = TestingSection.WRITING; this.btn_LoadTest_Click(new Button(), e); break; } this.QuestionNO++; this.CurrentSpeakingStep = 1; this.srtb_introduction.Visible = false; this.pb_speakingScene.Visible = true; this.srtb_timeindicator.Visible = false; this.srtb_timer.Visible = false; } break; } } }
public void LoadListeningQA() { int length; if (this.LOADLASTQUESTION) { this.LoadUserAnswer(); } Question question = (Question)this.TestQuestions.Questions[this.QuestionNO - 1]; base.lbl_questionNO.Text = "Question " + this.QuestionNO + " of 34"; this.llbl_rightAnswer.Visible = this.ckb_ShowAnswer.Checked; this.IsPassageMP3 = false; switch (question.QuestionType) { case QuestionType.TABEL: { int num5; this.tabf_test.SelectedIndex = LISTENING; this.tabf_Listening.SelectedIndex = LTABLEQUESTION; this.lrtbTableQuestion.Rtf = question.QuestionTitle; int count = question.ColStrs.Count; int num4 = question.RowStrs.Count; this.ltlp_table.RowCount = num4 + 1; this.ltlp_table.ColumnCount = count + 1; length = this.LRtbTableCol.Length; while (length < this.LRtbTableCol.Length) { this.LRtbTableCol[length].Rtf = ""; this.LRtbTableCol[length].Visible = false; num5 = this.LRtbTableRow.Length; while (num5 < this.LRtbTableRow.Length) { this.LRtbTableRow[num5].Rtf = ""; this.LRtbTableRow[num5].Visible = false; this.LCkbTable[num5][length].Visible = false; this.LCkbTable[num5][length].Checked = false; num5++; } length++; } for (length = 0; length < this.LRtbTableCol.Length; length++) { this.LRtbTableCol[length].Rtf = ""; this.LRtbTableCol[length].Visible = false; num5 = 0; while (num5 < this.LRtbTableRow.Length) { this.LRtbTableRow[num5].Rtf = ""; this.LRtbTableRow[num5].Visible = false; this.LCkbTable[num5][length].Visible = false; this.LCkbTable[num5][length].Checked = false; num5++; } } for (length = 0; length < count; length++) { this.LRtbTableCol[length].Rtf = (string)question.ColStrs[length]; this.LRtbTableCol[length].Visible = true; num5 = 0; while (num5 < num4) { this.LCkbTable[num5][length].Visible = true; this.LCkbTable[num5][length].Checked = false; num5++; } } for (num5 = 0; num5 < num4; num5++) { this.LRtbTableRow[num5].Rtf = (string)question.RowStrs[num5]; this.LRtbTableRow[num5].Visible = true; } if (this.ckb_ShowAnswer.Checked) { this.lbl_tableAnswer.Visible = true; this.lbl_tableAnswer.Text = question.RightAnswersStr; } else { this.lbl_tableAnswer.Visible = false; } goto Label_0656; } case QuestionType.SORT: if (question.QuestionType == QuestionType.SORT) { this.tabf_test.SelectedIndex = READING; this.tabf_Reading.SelectedIndex = RSUMMARYQUESTION; this.rtb_sumQuestion.Rtf = question.QuestionTitle; this.rtb_sumQuestion.Visible = true; length = 0; while (length < this.CkbSummarySelected.Length) { this.CkbSummarySelected[length].Checked = true; this.CkbSummarySelected[length].Text = ""; this.CkbSummarySelected[length].Visible = false; this.RtbSumSelected[length].Text = ""; this.RtbSumSelected[length].Visible = false; length++; } for (length = 0; length < this.CkbSummary.Length; length++) { this.RtbSumAnswersToBeSelected[length].Text = ""; this.RtbSumAnswersToBeSelected[length].Visible = false; this.CkbSummary[length].Checked = false; this.CkbSummary[length].Visible = false; } length = 0; while (length < question.UserAnswers.Count) { int num2 = Convert.ToInt16(question.UserAnswers[length]); if (num2 > 0) { this.SummarySelectedAnswerIndex = length + 1; this.CkbSummary[num2 - 1].Checked = true; } length++; } } break; default: this.tabf_test.SelectedIndex = LISTENING; this.tabf_Listening.SelectedIndex = LQUESTIONS; for (length = 0; length < this.LCkbAnswers.Length; length++) { this.LCkbAnswers[length].Visible = false; this.LRtbAnswers[length].Visible = false; this.LCkbAnswers[length].Checked = false; this.LCkbAnswers[length].Enabled = true; this.LRtbAnswers[length].BackColor = SystemColors.ControlLight; } this.lrtb_question.Rtf = question.QuestionTitle; for (length = 0; length < question.UserAnswers.Count; length++) { this.LCkbAnswers[((int)question.UserAnswers[length]) - 1].Checked = true; } for (int i = 0; i < question.RightAnswers.Length; i++) { if (this.ckb_ShowAnswer.Checked) { this.LRtbAnswers[question.RightAnswers[i] - 1].BackColor = Color.LightPink; } else { this.LRtbAnswers[question.RightAnswers[i] - 1].BackColor = SystemColors.ControlLight; } } goto Label_0656; } this.llbl_rightAnswer.Text = question.RightAnswersStr; Label_0656: try { this.MP3Player = new MP3MCI(); string str = ""; str = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", question.MP3Path }); this.MP3Player.FileName = str; this.PlayFileName.Text = str; 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(); this.BottonsStatus(); } catch { MessageBox.Show("open出错!"); } }
private void tab_speakinganswers_Leave(object sender, EventArgs e) { this.MP3Player.StopT(); this.MP3Player = new MP3MCI(); }
public void InitialParas() { if (!ISACTIVED) { Application.Exit(); } this.CONTINUECLICKED = false; this.MP3Player.StopT(); this.MP3Player = new MP3MCI(); this.MP3Recorder = new MP3Record(); this.Timer_reading.Stop(); this.tb_reading.Visible = false; this.bn_readText.Visible = false; this.btn_stopReading.Visible = false; this.Timer_Listening.Stop(); this.flash_timer.Stop(); this.Timer_Speaking.Stop(); this.btn_pause.BackgroundImage = (Image)this.resmgr.GetObject("pause"); this.btn_pause.Visible = false; this.llbl_rightAnswer.Visible = false; base.btn_mainmenu.Visible = false; base.btn_quit.Visible = false; this.lbl_testingSection.Visible = false; this.btn_ShowText.Visible = false; base.lbl_mode.Visible = false; base.lbl_questionNO.Visible = false; base.Sound_icon.Visible = false; base.tb_sound.Visible = false; base.btn_review.Visible = false; base.btn_preQuestion.Visible = false; base.btn_nextQuestion.Visible = false; this.ckb_viewSpeakingText.Visible = false; this.ckb_viewSpeakingText.Checked = false; this.ckb_ShowAnswer.Visible = false; this.ckb_ShowAnswer.Checked = false; base.lbl_timeremain.Visible = false; this.CurrentReadingStep = 0; this.RSpiltQuestionNO = 0; this.ReviewSelectedQuestionNO = -1; this.TestMode = 0; this.PartCount = 0; this.PassageCount = 0; this.QuestionCount = 0; this.PassageLastQuestionIndex = 0; this.PartLastPassageIndex = 0; this.InsertSetenceRtf = ""; this.PreInsertPosition = -1; this.IsRepeated = false; this.IsQuestionAfter = false; this.HasLoadMP3 = false; this.CurrentSpeakingStep = 0; this.CurrentWritingStep = 0; this.SummarySelectedAnswerIndex = -1; this.ShowPassage = false; }
public void LoadListeningMaterial() { this.IsPassageMP3 = true; this.tabf_test.SelectedIndex = LISTENING; if (this.ckb_viewSpeakingText.Checked) { this.tabf_Listening.SelectedIndex = LMATERIALS; } else { this.tabf_Listening.SelectedIndex = LMATERIALS1; } this.pb_ListenScene.Image = null; this.pb_ListenScene1.Image = null; if (this.PassageNO <= 1) { this.TestQuestions = new TPOQuestions(RtfReader.getRTF(@"Tests\" + this.TPONO + @"\Listening\questions.rtf"), @"Tests\" + this.TPONO + @"\Listening\questions.xml", ""); } base.lbl_questionNO.Text = "Question " + this.QuestionNO.ToString() + " of 34"; XMLFileReader reader = new XMLFileReader(@"Tests\" + this.TPONO + @"\Listening\questions.xml"); string attr = reader.GetAttr(string.Concat(new object[] { "//part[@NO=", this.PartNO, "]/passage[@NO=", this.PassageNO, "]/@Content" })); this.PassageLastQuestionIndex = int.Parse(reader.GetAttr(string.Concat(new object[] { "//part[@NO=", this.PartNO, "]/passage[@NO=", this.PassageNO, "]/@lastQuestionIndex" }))); this.PartLastPassageIndex = int.Parse(reader.GetAttr("//part[@NO=" + this.PartNO + "]/@lastPassageIndex")); int num = int.Parse(reader.GetAttr("//passage[@NO=" + this.PassageNO + "]/pictures/@pictureCount")); this.SPicturePaths = new string[num]; this.SPictureTimeLines = new string[num]; for (int i = 1; i < (num + 1); i++) { this.SPicturePaths[i - 1] = reader.GetAttr(string.Concat(new object[] { "//passage[@NO=", this.PassageNO, "]/pictures/picture[@NO=", i, "]/@pictureName" })); this.SPictureTimeLines[i - 1] = reader.GetAttr(string.Concat(new object[] { "//passage[@NO=", this.PassageNO, "]/pictures/picture[@NO=", i, "]/@Start" })); } this.loadLRC(string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", reader.GetAttr(string.Concat(new object[] { "//part[@NO=", this.PartNO, "]/passage[@NO=", this.PassageNO, "]/@passageName" })) })); try { this.MP3Player = new MP3MCI(); string str2 = string.Concat(new object[] { @"Tests\", this.TPONO, @"\Listening\", attr }); this.MP3Player.FileName = str2; this.PlayFileName.Text = str2; 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(); this.IsPassageMP3 = true; } catch { MessageBox.Show("open出错!"); } }
public MainForm() { int num; this.components = null; this.IsPassageMP3 = false; this.CurrentReadingStep = 0; this.PreFormHeight = 0x268; this.PreFormWidth = 0x31a; this.CurrentTPOPage = 1; this.TPONO = 0; this.PassageNO = 0; this.PartNO = 0; this.QuestionNO = 0; this.RSpiltQuestionNO = 0; this.ReviewSelectedQuestionNO = -1; this.TestMode = 0; this.PartCount = 0; this.PassageCount = 0; this.QuestionCount = 0; this.PassageLastQuestionIndex = 0; this.PartLastPassageIndex = 0; this.InsertSetenceRtf = ""; this.PreInsertPosition = -1; this.MP3Player = new MP3MCI(); this.IsRepeated = false; this.IsQuestionAfter = false; this.HasLoadMP3 = false; this.CurrentSpeakingStep = 0; this.CurrentWritingStep = 0; this.BtnLoadTest = new Button[0x3d]; this.CkbReading = new CheckBox[8]; this.RtbReadingAnswers = new RichTextBox[8]; this.CkbSummary = new CheckBox[10]; this.CkbSummarySelected = new CheckBox[5]; this.RtbSumAnswersToBeSelected = new RichTextBox[10]; this.RtbSumSelected = new RichTextBox[5]; this.SummarySelectedAnswerIndex = -1; this.ShowPassage = false; this.SummarySelectedAnswers = new int[5]; this.LCkbAnswers = new CheckBox[8]; this.LRtbAnswers = new RichTextBox[8]; this.LRtbTableRow = new RichTextBox[9]; this.LRtbTableCol = new RichTextBox[5]; this.LCkbTable = new CheckBox[9][]; this.IsPause = false; this.LOADLASTQUESTION = false; this.HasClickedNext = false; this.ReadingPassageNo = 1; this.CONTINUECLICKED = false; this.TotalScore = 0; this.RightAnsweredQuestions = 0; this.WrongAnsweredQuestions = 0; this.NotAnsweredQuestions = 0; this.TotalQuestions = 0; this.IBTScore = 0; this.EXP = new ExplanationUI(); this.TRANSUI = new TranslationUI(); this.CurrentReadingPassage = 1; this.InitializeComponent(); this.PreFormHeight = base.Height; this.PreFormWidth = base.Width; base.WindowState = FormWindowState.Maximized; this.CkbReading[0] = this.ckb_A; this.CkbReading[1] = this.ckb_B; this.CkbReading[2] = this.ckb_C; this.CkbReading[3] = this.ckb_D; this.CkbReading[4] = this.ckb_E; this.CkbReading[5] = this.ckb_F; this.CkbReading[6] = this.ckb_G; this.CkbReading[7] = this.ckb_H; this.LCkbAnswers[0] = this.lckb_A; this.LCkbAnswers[1] = this.lckb_B; this.LCkbAnswers[2] = this.lckb_C; this.LCkbAnswers[3] = this.lckb_D; this.LCkbAnswers[4] = this.lckb_E; this.LCkbAnswers[5] = this.lckb_F; this.LCkbAnswers[6] = this.lckb_G; this.LCkbAnswers[7] = this.lckb_H; this.RtbReadingAnswers[0] = this.rtb_answerA; this.RtbReadingAnswers[1] = this.rtb_answerB; this.RtbReadingAnswers[2] = this.rtb_answerC; this.RtbReadingAnswers[3] = this.rtb_answerD; this.RtbReadingAnswers[4] = this.rtb_answerE; this.RtbReadingAnswers[5] = this.rtb_answerF; this.RtbReadingAnswers[6] = this.rtb_answerG; this.RtbReadingAnswers[7] = this.rtb_answerH; this.LRtbAnswers[0] = this.lrtb_answerA; this.LRtbAnswers[1] = this.lrtb_answerB; this.LRtbAnswers[2] = this.lrtb_answerC; this.LRtbAnswers[3] = this.lrtb_answerD; this.LRtbAnswers[4] = this.lrtb_answerE; this.LRtbAnswers[5] = this.lrtb_answerF; this.LRtbAnswers[6] = this.lrtb_answerG; this.LRtbAnswers[7] = this.lrtb_answerH; for (num = 0; num < 9; num++) { this.LCkbTable[num] = new CheckBox[5]; for (int i = 0; i < 5; i++) { this.LCkbTable[num][i] = new CheckBox(); } } this.LCkbTable[0][0] = this.lckbTable11; this.LCkbTable[0][1] = this.lckbTable12; this.LCkbTable[0][2] = this.lckbTable13; this.LCkbTable[0][3] = this.lckbTable14; this.LCkbTable[0][4] = this.lckbTable15; this.LCkbTable[1][0] = this.lckbTable21; this.LCkbTable[1][1] = this.lckbTable22; this.LCkbTable[1][2] = this.lckbTable23; this.LCkbTable[1][3] = this.lckbTable24; this.LCkbTable[1][4] = this.lckbTable25; this.LCkbTable[2][0] = this.lckbTable31; this.LCkbTable[2][1] = this.lckbTable32; this.LCkbTable[2][2] = this.lckbTable33; this.LCkbTable[2][3] = this.lckbTable34; this.LCkbTable[2][4] = this.lckbTable35; this.LCkbTable[3][0] = this.lckbTable41; this.LCkbTable[3][1] = this.lckbTable42; this.LCkbTable[3][2] = this.lckbTable43; this.LCkbTable[3][3] = this.lckbTable44; this.LCkbTable[3][4] = this.lckbTable45; this.LCkbTable[4][0] = this.lckbTable51; this.LCkbTable[4][1] = this.lckbTable52; this.LCkbTable[4][2] = this.lckbTable53; this.LCkbTable[4][3] = this.lckbTable54; this.LCkbTable[4][4] = this.lckbTable55; this.LCkbTable[5][0] = this.lckbTable61; this.LCkbTable[5][1] = this.lckbTable62; this.LCkbTable[5][2] = this.lckbTable63; this.LCkbTable[5][3] = this.lckbTable64; this.LCkbTable[5][4] = this.lckbTable65; this.LCkbTable[6][0] = this.lckbTable71; this.LCkbTable[6][1] = this.lckbTable72; this.LCkbTable[6][2] = this.lckbTable73; this.LCkbTable[6][3] = this.lckbTable74; this.LCkbTable[6][4] = this.lckbTable75; this.LCkbTable[7][0] = this.lckbTable81; this.LCkbTable[7][1] = this.lckbTable82; this.LCkbTable[7][2] = this.lckbTable83; this.LCkbTable[7][3] = this.lckbTable84; this.LCkbTable[7][4] = this.lckbTable85; this.LCkbTable[8][0] = this.lckbTable91; this.LCkbTable[8][1] = this.lckbTable92; this.LCkbTable[8][2] = this.lckbTable93; this.LCkbTable[8][3] = this.lckbTable94; this.LCkbTable[8][4] = this.lckbTable95; this.LRtbTableRow[0] = this.lrtbTableRow1; this.LRtbTableRow[1] = this.lrtbTableRow2; this.LRtbTableRow[2] = this.lrtbTableRow3; this.LRtbTableRow[3] = this.lrtbTableRow4; this.LRtbTableRow[4] = this.lrtbTableRow5; this.LRtbTableRow[5] = this.lrtbTableRow6; this.LRtbTableRow[6] = this.lrtbTableRow7; this.LRtbTableRow[7] = this.lrtbTableRow8; this.LRtbTableRow[8] = this.lrtbTableRow9; this.LRtbTableCol[0] = this.lrtbTableCol1; this.LRtbTableCol[1] = this.lrtbTableCol2; this.LRtbTableCol[2] = this.lrtbTableCol3; this.LRtbTableCol[3] = this.lrtbTableCol4; this.LRtbTableCol[4] = this.lrtbTableCol5; for (num = 0; num < 8; num++) { this.RtbReadingAnswers[num].TextChanged += new EventHandler(this.RtbAnswers_TextChanged); this.CkbReading[num].CheckedChanged += new EventHandler(this.Ckb_CheckedChanged); this.LCkbAnswers[num].CheckedChanged += new EventHandler(this.Ckb_CheckedChanged); } this.CkbSummary[0] = this.ckb_sumAnswer1; this.CkbSummary[1] = this.ckb_sumAnswer2; this.CkbSummary[2] = this.ckb_sumAnswer3; this.CkbSummary[3] = this.ckb_sumAnswer4; this.CkbSummary[4] = this.ckb_sumAnswer5; this.CkbSummary[5] = this.ckb_sumAnswer6; this.CkbSummary[6] = this.ckb_sumAnswer7; this.CkbSummary[7] = this.ckb_sumAnswer8; this.CkbSummary[8] = this.ckb_sumAnswer9; this.CkbSummary[9] = this.ckb_sumAnswer10; this.RtbSumAnswersToBeSelected[0] = this.rtb_sumAnswer1; this.RtbSumAnswersToBeSelected[1] = this.rtb_sumAnswer2; this.RtbSumAnswersToBeSelected[2] = this.rtb_sumAnswer3; this.RtbSumAnswersToBeSelected[3] = this.rtb_sumAnswer4; this.RtbSumAnswersToBeSelected[4] = this.rtb_sumAnswer5; this.RtbSumAnswersToBeSelected[5] = this.rtb_sumAnswer6; this.RtbSumAnswersToBeSelected[6] = this.rtb_sumAnswer7; this.RtbSumAnswersToBeSelected[7] = this.rtb_sumAnswer8; this.RtbSumAnswersToBeSelected[8] = this.rtb_sumAnswer9; this.RtbSumAnswersToBeSelected[9] = this.rtb_sumAnswer10; for (num = 0; num < 10; num++) { this.RtbSumAnswersToBeSelected[num].TextChanged += new EventHandler(this.RtbAnswers_TextChanged); this.CkbSummary[num].CheckedChanged += new EventHandler(this.CkbSummary_CheckedChanged); } this.CkbSummarySelected[0] = this.ckb_SumSelected1; this.CkbSummarySelected[1] = this.ckb_SumSelected2; this.CkbSummarySelected[2] = this.ckb_SumSelected3; this.CkbSummarySelected[3] = this.ckb_SumSelected4; this.CkbSummarySelected[4] = this.ckb_SumSelected5; this.RtbSumSelected[0] = this.rtb_SumSelected1; this.RtbSumSelected[1] = this.rtb_SumSelected2; this.RtbSumSelected[2] = this.rtb_SumSelected3; this.RtbSumSelected[3] = this.rtb_SumSelected4; this.RtbSumSelected[4] = this.rtb_SumSelected5; for (num = 0; num < 5; num++) { this.RtbSumSelected[num].Click += new EventHandler(this.RtbSumSelected_Click); this.RtbSumSelected[num].TextChanged += new EventHandler(this.RtbAnswers_TextChanged); this.CkbSummarySelected[num].CheckedChanged += new EventHandler(this.CkbSummarySelected_CheckedChanged); } this.rtb_question.TextChanged += new EventHandler(this.RtbAnswers_TextChanged); this.rtb_sumQuestion.TextChanged += new EventHandler(this.RtbAnswers_TextChanged); this.BtnLoadTest[1] = this.btn_LoadReading01; this.BtnLoadTest[2] = this.btn_LoadReading02; this.BtnLoadTest[3] = this.btn_LoadReading03; this.BtnLoadTest[4] = this.btn_LoadReading04; this.BtnLoadTest[5] = this.btn_LoadReading05; this.BtnLoadTest[6] = this.btn_LoadReading06; this.BtnLoadTest[7] = this.btn_LoadReading07; this.BtnLoadTest[8] = this.btn_LoadReading08; this.BtnLoadTest[9] = this.btn_LoadReading09; this.BtnLoadTest[10] = this.btn_LoadReading10; this.BtnLoadTest[11] = this.btn_LoadListening01; this.BtnLoadTest[12] = this.btn_LoadListening02; this.BtnLoadTest[13] = this.btn_LoadListening03; this.BtnLoadTest[14] = this.btn_LoadListening04; this.BtnLoadTest[15] = this.btn_LoadListening05; this.BtnLoadTest[0x10] = this.btn_LoadListening06; this.BtnLoadTest[0x11] = this.btn_LoadListening07; this.BtnLoadTest[0x12] = this.btn_LoadListening08; this.BtnLoadTest[0x13] = this.btn_LoadListening09; this.BtnLoadTest[20] = this.btn_LoadListening10; this.BtnLoadTest[0x15] = this.btn_LoadSpeaking01; this.BtnLoadTest[0x16] = this.btn_LoadSpeaking02; this.BtnLoadTest[0x17] = this.btn_LoadSpeaking03; this.BtnLoadTest[0x18] = this.btn_LoadSpeaking04; this.BtnLoadTest[0x19] = this.btn_LoadSpeaking05; this.BtnLoadTest[0x1a] = this.btn_LoadSpeaking06; this.BtnLoadTest[0x1b] = this.btn_LoadSpeaking07; this.BtnLoadTest[0x1c] = this.btn_LoadSpeaking08; this.BtnLoadTest[0x1d] = this.btn_LoadSpeaking09; this.BtnLoadTest[30] = this.btn_LoadSpeaking10; this.BtnLoadTest[0x1f] = this.btn_LoadWriting01; this.BtnLoadTest[0x20] = this.btn_LoadWriting02; this.BtnLoadTest[0x21] = this.btn_LoadWriting03; this.BtnLoadTest[0x22] = this.btn_LoadWriting04; this.BtnLoadTest[0x23] = this.btn_LoadWriting05; this.BtnLoadTest[0x24] = this.btn_LoadWriting06; this.BtnLoadTest[0x25] = this.btn_LoadWriting07; this.BtnLoadTest[0x26] = this.btn_LoadWriting08; this.BtnLoadTest[0x27] = this.btn_LoadWriting09; this.BtnLoadTest[40] = this.btn_LoadWriting10; this.BtnLoadTest[0x29] = this.btn_Review01; this.BtnLoadTest[0x2a] = this.btn_Review02; this.BtnLoadTest[0x2b] = this.btn_Review03; this.BtnLoadTest[0x2c] = this.btn_Review04; this.BtnLoadTest[0x2d] = this.btn_Review05; this.BtnLoadTest[0x2e] = this.btn_Review06; this.BtnLoadTest[0x2f] = this.btn_Review07; this.BtnLoadTest[0x30] = this.btn_Review08; this.BtnLoadTest[0x31] = this.btn_Review09; this.BtnLoadTest[50] = this.btn_Review10; this.BtnLoadTest[0x33] = this.btn_Answer01; this.BtnLoadTest[0x34] = this.btn_Answer02; this.BtnLoadTest[0x35] = this.btn_Answer03; this.BtnLoadTest[0x36] = this.btn_Answer04; this.BtnLoadTest[0x37] = this.btn_Answer05; this.BtnLoadTest[0x38] = this.btn_Answer06; this.BtnLoadTest[0x39] = this.btn_Answer07; this.BtnLoadTest[0x3a] = this.btn_Answer08; this.BtnLoadTest[0x3b] = this.btn_Answer09; this.BtnLoadTest[60] = this.btn_Answer10; }
private void btn_stopReading_Click(object sender, EventArgs e) { this.MP3Player.StopT(); this.MP3Player = new MP3MCI(); this.bn_readText.Enabled = true; this.btn_stopReading.Visible = false; this.tb_reading.Visible = false; this.Timer_reading.Stop(); }
private void btn_speakinganswer_Click(object sender, EventArgs e) { this.MP3Player.StopT(); this.MP3Player = new MP3MCI(); Button button = (Button)sender; string str = button.Name.Substring(button.Name.Length - 1); string path = string.Concat(new object[] { Application.StartupPath, @"\users\", USERNAME, @"\", this.TPONO, @"\SpeakingAnswer", str, ".wav" }); if (File.Exists(path)) { this.MP3Player.FileName = path; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); } else { MessageBox.Show("You didn't answer this question yet!"); } }
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); } }
private void bn_readText_Click(object sender, EventArgs e) { this.CurrentReadingPassage = this.ReadingPassageNo; try { this.MP3Player.StopT(); this.MP3Player = new MP3MCI(); string path = Application.StartupPath + @"\Explanations\" + this.TPONO.ToString() + @"\Reading\" + this.ReadingPassageNo.ToString() + ".mp3"; if (File.Exists(path)) { this.MP3Player.FileName = path; this.MP3Player.play(); this.MP3Player.SetVolume(base.tb_sound.Value.ToString()); this.bn_readText.Enabled = false; this.btn_stopReading.Visible = true; this.tb_reading.Visible = true; this.tb_reading.Maximum = this.MP3Player.Duration; this.Timer_reading.Start(); } } catch { } }