private void SecNav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { var SelectedItem = (sender.SelectedItem as NavigationViewItem); if (SelectedItem == null) { return; } CourseEntry SelectedCourse = null; foreach (var x in AllCourses.Instance.CoursesList) { if ((NavView.SelectedItem as NavigationViewItem).Content.ToString() == x.Title) { SelectedCourse = x; break; } } HDDSync.SelectedCourse = SelectedCourse; LoggingServices.Instance.WriteLine <MainPage>(SelectedItem.Content as string + " Tab of " + NavView.Header as string + " is selected."); switch (SelectedItem.Content) { case "Overview": ContentFrame.Navigate(typeof(Overview)); break; case "Books": ContentFrame.Navigate(typeof(Books), SelectedCourse.BookEntry); break; case "Handout": ContentFrame.Navigate(typeof(Handout), SelectedCourse.HandoutEntry); break; case "Teachers": ContentFrame.Navigate(typeof(Teachers), SelectedCourse); break; case "CT log": ContentFrame.Navigate(typeof(CT_log), SelectedCourse.CTLog); break; case "Time Table": ContentFrame.Navigate(typeof(TimeTable), SelectedCourse); break; case "Events": ContentFrame.Navigate(typeof(Events), SelectedCourse.EventEntry); break; case "Tests": ContentFrame.Navigate(typeof(Tests), SelectedCourse.TestEntry); break; } }
public void RequestCourse(CourseEntry course) { var courseToRequest = _courseRepository.GetFirst(c => c.CourseId == course.CourseId); course.IsPaid = courseToRequest.Cost > 0; _courseEntryRepository.Create(course); _unitOfWork.SaveChanges(); }
public static void SaveCourseToHdd(CourseEntry e) { if (!Directory.Exists(CourseDirectoryLocation)) { Directory.CreateDirectory(CourseDirectoryLocation); } using (Stream m = new FileStream(Path.Combine(CourseDirectoryLocation, e.Title + ".bin"), FileMode.Create, FileAccess.Write)) { new BinaryFormatter().Serialize(m, e); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { SelectedCourse = e.Parameter as CourseEntry; foreach (var x in CourseTeachers.lists) { if (x.GetView == null) { x.InitializeTeacher(); } ViewList.Items.Add(x.GetView); } }
public ActionResult RequestCourse(int id) { var user = _userService.GetCurrent(User.Identity.Name); var course = new CourseEntry { ClientId = user.Client.ClientId, CourseId = id, }; _courseService.RequestCourse(course); return(RedirectToAction("UserProfile", "User")); }