private void btnNO_Click(object sender, RoutedEventArgs e) { Close(); TestEndWindow test = new TestEndWindow(); test.Close(); }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { using (var db = new LanguageTutorialContext()) { if (LanguageID == 1) { var session = new Session(); session.CourseId = App.oCourseEnglish.Id; session.Words = CountRightWords; session.Points = Result; session.Datetime = DateTime.Now; session.FinishedWords = isLearned; db.Session.Add(session); } if (LanguageID == 2) { var session = new Session(); session.CourseId = App.oCourseFrançais.Id; session.Words = CountRightWords; session.Points = Result; session.Datetime = DateTime.Now; session.FinishedWords = isLearned; db.Session.Add(session); } db.SaveChanges(); //Проверка на то, что пользователь прошел веь курс var result = db.WordQueue.Where(wq => wq.UserId == App.oActiveUser.Id && wq.WordDictionary.LanguageId == LanguageID && wq.IsLearned == false).ToList(); if (result.Count == 0) { //Ты прошел весь курс TestEndWindow testEnd = new TestEndWindow(LanguageID); testEnd.ShowDialog(); } } }