示例#1
0
文件: Word.cs 项目: zw921005/beitimu
 void show(wordQuestion wq)
 {
     if (showID)
     {
         lblquestion.Text = wq.id.ToString() + "." + wq.question;
     }
     else
     {
         lblquestion.Text = wq.question;
     }
     lblanswer.Text    = "";
     lblPageIndex.Text = (currentQuestion + 1).ToString();
     if (review)
     {
         lblanswer.Text = wqs[currentQuestion].answer;
     }
 }
示例#2
0
文件: Word.cs 项目: zw921005/beitimu
 private void Word_Load(object sender, EventArgs e)
 {
     try
     {
         string fileName;
         if (IsSingle)
         {
             this.Text = "简答题";
             fileName  = "data2";
         }
         else
         {
             this.Text = "填空题";
             fileName  = "data3";
         }
         foreach (string line in System.IO.File.ReadLines("data/" + fileName, System.Text.Encoding.UTF8))
         {
             wordQuestion wq = new wordQuestion(line);
             wqs.Add(wq);
         }
         if (randomQuestion)
         {
             Random rd = new Random();
             for (int i = 0; i < wqs.Count(); i++)
             {
                 int          index = rd.Next(wqs.Count());
                 wordQuestion temp  = wqs[i];
                 wqs[i]     = wqs[index];
                 wqs[index] = temp;
             }
         }
         lblresult.Text   = "";
         totalQuestion    = wqs.Count();
         lblPageSize.Text = totalQuestion.ToString();
         show(wqs[0]);
     }
     catch (Exception ex)
     {
         this.Close();
         MessageBox.Show(ex.Message);
     }
 }