Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     // number++;
     //if (number >= 10) number = 0;
     //若未记单词满10个,则只复习未记忆的单词(调用UnRemNumber)
     if (UnRemDic.Count >= 11)
     {
         if (UnRemNumber >= UnRemDic.Count - 1)
         {
             UnRemNumber = 0;
         }
         string[] WordArray = Regex.Split(UnRemDic[UnRemNumber], "&&&&");
         WordLabel.Text   = WordArray[0];
         DetailLabel.Text = WordArray[1];
         UnRemNumber++;
     }
     else
     {
         //否则 随机获取下一个单词,并且将单词该未记忆单词放入UnRemDic
         UnRemDic.Add(WordLabel.Text + "&&&&" + DetailLabel.Text);
         string   str_words = File.ReadAllText("unremember.txt", Encoding.Default);
         string[] words     = Regex.Split(str_words, "\r\n");
         #region 随机单词
         Random r = new Random();
         number = r.Next(words.Length - 1);
         #endregion
         WordLabel.Text   = Regex.Split(words[number], " ")[0];
         DetailLabel.Text = words[number].Replace(WordLabel.Text, string.Empty);
         DetailLabel.Hide();
     }
 }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;
            //1、读取未记忆单词
            string str_words = File.ReadAllText("unremember.txt", Encoding.Default);

            string[] words = Regex.Split(str_words, "\r\n");
            WordLabel.Text   = Regex.Split(words[number], " ")[0];
            DetailLabel.Text = words[number].Replace(WordLabel.Text, string.Empty);
            DetailLabel.Hide();
        }
Ejemplo n.º 3
0
        private void RememberButton_Click(object sender, EventArgs e)
        {
            string str_words = File.ReadAllText("unremember.txt", Encoding.Default);

            string[] words = Regex.Split(str_words, "\r\n");
            str_words = str_words.Replace(WordLabel.Text + DetailLabel.Text + "\r\n", string.Empty);
            File.AppendAllText("remember.txt", WordLabel.Text + DetailLabel.Text + "\r\n", Encoding.Default);
            File.WriteAllText("unremember.txt", str_words, Encoding.Default);
            string s         = File.ReadAllText("unremember.txt");
            int    LeftWords = (s.Length - s.Replace("\r\n", string.Empty).Length) / 4;

            LeftWordsLabel.Text = "剩余单词:" + LeftWords;
            str_words           = File.ReadAllText("unremember.txt", Encoding.Default);
            words = Regex.Split(str_words, "\r\n");
            #region 随机单词
            Random r = new Random();
            number = r.Next(words.Length - 1);
            #endregion
            WordLabel.Text   = Regex.Split(words[number], " ")[0];
            DetailLabel.Text = words[number].Replace(WordLabel.Text, string.Empty);
            DetailLabel.Hide();
        }