Example #1
0
 private void StopActualLesson()
 {
     StartStopButtonText = "Start";
     ShowLessonPanel     = false;
     ShowResultPanel     = false;
     IsLessonRunning     = false;
     LessonDispatcherTimer.Stop();
     LessonFinishedText = "Finished in " + TimeElapsed;
 }
Example #2
0
 private void StartActualLesson()
 {
     StartStopButtonText = "Stop";
     ShowLessonPanel     = true;
     ShowResultPanel     = true;
     IsLessonRunning     = true;
     LessonStartingTime  = DateTime.Now;
     LessonDispatcherTimer.Start();
     using (var db = Database.Instance.GetConnection())
     {
         LessonWords.Clear();
         LessonWordsAll.Clear();
         CurrentUserLessonHistory.Clear();
         foreach (Word w in db.Table <Word>().Where(w => w.LessonId == CurrentLesson.Id))
         {
             LessonWords.Add(w);
             LessonWordsAll.Add(w);
             var     fetchedHistory = db.Table <History>().Where(h => h.UserId == CurrentUser.Id && h.WordId == w.Id);
             History wordHistory    = null;
             if (fetchedHistory.Count() == 0)
             {
                 wordHistory = new History()
                 {
                     UserId = CurrentUser.Id, WordId = w.Id
                 };
             }
             else
             {
                 wordHistory = fetchedHistory.First();
             }
             CurrentUserLessonHistory[w] = wordHistory;
         }
     }
     PrepareWord();
     CorrectAnswers = 0;
     SkippedAnswers = 0;
     WrongAnswers   = 0;
 }