コード例 #1
0
        private static int SetTestRecord(MP3Record mp3Record)
        {
            int lastSongID = -1;

            if (MD5Exist(mp3Record.MD5, true) == false)
            {
                try
                {
                    var context = new MyJukeboxEntities();
                    // tsongs_tst data
                    var songs = new tSongs_tst();
                    songs.Album      = mp3Record.Album;
                    songs.Artist     = mp3Record.Artist;
                    songs.Titel      = mp3Record.Titel;
                    songs.Pfad       = mp3Record.Path;
                    songs.FileName   = mp3Record.FileName;
                    songs.ID_Genre   = mp3Record.Genre;
                    songs.ID_Catalog = mp3Record.Catalog;
                    songs.ID_Media   = mp3Record.Media;
                    context.tSongs_tst.Add(songs);
                    context.SaveChanges();

                    lastSongID = GetLastID("tSongs_tst");

                    // tmd5 data
                    //var md5 = new tMD5_tst();
                    //md5.MD5 = mp3Record.MD5;
                    //md5.ID_Song = lastSongID;
                    //context.tMD5_tst.Add(md5);
                    //context.SaveChanges();

                    // tfileinfo data
                    //var file = new tFileInfos_tst();
                    //file.FileDate = mp3Record.FileDate;
                    //file.FileSize = mp3Record.FileSize;
                    //file.ImportDate = DateTime.Now;
                    //file.ID_Song = lastSongID;
                    //context.tFileInfos_tst.Add(file);
                    //context.SaveChanges();

                    // tinfos data
                    //var info = new tInfos_tst();
                    //info.Sampler = mp3Record.IsSample;
                    //info.ID_Song = lastSongID;
                    //context.tInfos_tst.Add(info);
                    //context.SaveChanges();

                    return(1);
                }
                catch (Exception ex)
                {
                    Debug.Print($"SetNewTestRecord_Error: {ex.Message}");
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
コード例 #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (IsSongChanged == true)
            {
                mp3Record          = new MP3Record();
                mp3Record.Genre    = comboBoxGenre.Text;
                mp3Record.Catalog  = comboBoxCatalog.Text;
                mp3Record.Album    = textBoxAlbum.Text;
                mp3Record.Artist   = textBoxInterpret.Text;
                mp3Record.Titel    = textBoxTitel.Text;
                mp3Record.Path     = textBoxPath.Text;
                mp3Record.FileName = textBoxFilename.Text;

                bool result = DataGetSet.EditSaveSongChanges(_id, mp3Record);
            }

            if (IsFileInfoChanged == true)
            {
                mp3Record          = new MP3Record();
                mp3Record.FileSize = Convert.ToInt32(textBoxFilesize.Text);
                mp3Record.FileDate = Convert.ToDateTime(textBoxFiledate.Text);
                mp3Record.Duration = TimeSpan.Parse(textBoxDuration.Text);

                bool result = DataGetSet.EditSaveFileinfoChanges(_id, mp3Record);
            }

            if (IsSongInfoChanged == true)
            {
                mp3Record          = new MP3Record();
                mp3Record.IsSample = chechBoxSampler.Checked;
                mp3Record.Error    = checkBoxError.Checked;
                mp3Record.Hide     = checkBoxHide.Checked;
                mp3Record.Comment  = textboxComment.Text;
                mp3Record.Media    = Convert.ToInt32(textBoxMedia.Text);
            }

            #region Zeuch
            //if (textBoxTitel.Text != (string)textBoxTitel.Tag)
            //{

            //}

            //foreach( c In Me)
            //{
            //    if ( c.BackColor = +HC0C0FF )
            //    {
            //      // Textfeld wurde bearbeitet;
            //        if ( IsFieldChanged(c) )
            //        {
            //          SaveChanges c;
            //        }
            //    }
            //}
            #endregion
        }
コード例 #3
0
        private List <MP3Record> mp3Records(List <FileDetails> list, bool isSampler)
        {
            List <MP3Record> mp3List = new List <MP3Record>();

            foreach (FileDetails item in list)
            {
                if (Convert.ToBoolean(buttonCancel.Tag) == true)
                {
                    break;
                }

                if (!item.Path.Contains(comboboxAlbum.Text))
                {
                    continue;
                }

                MP3Record mp3 = new MP3Record();

                mp3.Genre    = comboboxGenre.SelectedIndex;
                mp3.Catalog  = comboboxCatalog.SelectedIndex;
                mp3.Media    = comboboxMedia.SelectedIndex;
                mp3.Album    = comboboxAlbum.Text;
                mp3.Titel    = item.File;
                mp3.FileName = item.File + item.Extension;
                mp3.FileSize = Convert.ToInt32(item.Size);
                mp3.FileDate = item.LastWrite;
                mp3.Path     = item.Path;
                mp3.IsSample = isSampler;
                mp3.MD5      = Helpers.MD5($"{mp3.Path}\\{mp3.FileName}");


                if (item.File.Contains('-'))
                {
                    var ar = item.File.Split('-');
                    mp3.Titel  = ar[1].Trim();
                    mp3.Artist = ar[0].Trim();
                }
                else
                {
                    var           artist = item.Path.Replace(mp3.Album, "");
                    DirectoryInfo di     = new DirectoryInfo(artist);
                    mp3.Titel  = item.File;
                    mp3.Artist = di.Name;
                }

                mp3List.Add(mp3);
            }

            return(mp3List);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: Evangileon/TPO-emulator
        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;
                }
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: Evangileon/TPO-emulator
 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;
 }