Example #1
0
 public RecordControl(MainWindow mainWindow)
 {
     InitializeComponent();
     User    = mainWindow.User;
     MainWin = mainWindow;
     if (User != null)
     {
         RecordService.ShowUserWords(User, 0).ForEach(r => LearnedWords.Add(r.KeyWord));
         RecordService.ShowUserWords(User, 1).ForEach(r => LearningWords.Add(r.KeyWord));
         this.listBox1.DataSource = LearnedWords;
         this.listBox2.DataSource = Datas.Lexicon[6];//暂定
         this.listBox3.DataSource = RecordService.ShowReadPara(User);
         List <string> quesList = new List <string>();
         RecordService.ShowQuesSet(User).ForEach(q =>
         {
             if (q.IsPass == true)
             {
                 quesList.Add("√" + q.Problem);
             }
             else
             {
                 quesList.Add("×" + q.Problem);
             }
         });
         this.listBox4.DataSource = quesList;
     }
 }
Example #2
0
        public void UpdateLearningWord(Word word)
        {
            LearningWords[word]++;

            if (LearningWords[word] >= word.CountToBeLearned)
            {
                LearningWords.Remove(word);
                LearnedWords.Add(word, word.CountToBeLearned);
            }
        }
Example #3
0
        private void ShuffleCommandAction(object o)
        {
            ImageVisible = false;
            if (!string.IsNullOrEmpty(SelectedCategory) && LearningWords != null)
            {
                List <LearningWord> lstLw    = LearningWords.Where(q => q.PolishCategory == SelectedCategory).ToList();
                List <LearningWord> lstBadLw = new List <LearningWord>(lstLw);
                Random       r   = new Random();
                int          idx = r.Next(0, lstLw.Count());
                LearningWord lw  = lstLw.ElementAt(idx);

                GeneratedWord           = lw.Polish;
                properCorrespondingWord = lw.English;

                lstBadLw.RemoveAt(idx);

                int firstWrongIdx = r.Next(0, lstBadLw.Count());
                firstWrongCorrespondingWord = lstBadLw[firstWrongIdx].English;

                lstBadLw.RemoveAt(firstWrongIdx);

                int secondWrongIdx = r.Next(0, lstBadLw.Count());
                secondWrongCorrespondingWord = lstBadLw[secondWrongIdx].English;


                //ustawienie buttonow;
                int okIdx = r.Next(0, 3);
                if (Settings.TestModeEnglishWords)
                {
                    if (okIdx == 0)
                    {
                        HintA = properCorrespondingWord;
                        HintC = secondWrongCorrespondingWord;
                        HintB = firstWrongCorrespondingWord;
                    }
                    if (okIdx == 1)
                    {
                        HintB = properCorrespondingWord;
                        HintA = firstWrongCorrespondingWord;
                        HintC = secondWrongCorrespondingWord;
                    }
                    if (okIdx == 2)
                    {
                        HintC = properCorrespondingWord;
                        HintA = firstWrongCorrespondingWord;
                        HintB = secondWrongCorrespondingWord;
                    }
                }
                else
                {
                    InputAnswer = "";
                    HintA       = Language.btnAnswer;
                    HintB       = Language.btnAnswer;
                    HintC       = Language.btnAnswer;
                }
            }
            else
            {
                UserDialogs.Instance.Alert(Language.txtLearningSetCategory, Language.txtErrorTitle);
            }
        }