private async Task ExecuteOpenHomeWorkCommand(LessonRealm lesson) { LessonsViewModel lessonsViewModel = this; lessonsViewModel._singleNavigation.DisableNavigation(); if (lesson.IsTanuloHaziFeladatEnabled) { int num1 = await lessonsViewModel._navigationService.Navigate <HomeWorkStudentDetailViewModel, LessonRealm>((M1)lesson, (IMvxBundle)null, new CancellationToken()) ? 1 : 0; } else { int num2 = await lessonsViewModel._navigationService.Navigate <HomeWorkDetailViewModel, LessonRealm>((M1)lesson, (IMvxBundle)null, new CancellationToken()) ? 1 : 0; } }
private async Task InitDays() { LessonsViewModel lessonsViewModel = this; lessonsViewModel.IsError = false; lessonsViewModel.IsLoading = true; lessonsViewModel.IsOffline = false; try { IEnumerable <LessonRealm> lessonRealms; if (!lessonsViewModel.HasInternetConnection) { lessonRealms = lessonsViewModel._lessonDataService.GetLessons(lessonsViewModel.ActiveProfileRealm.RolelessId, lessonsViewModel.FirstDayOfWeek, lessonsViewModel.LastDayOfWeek); if (lessonRealms == null) { lessonsViewModel.ShowError(); } } else if (lessonsViewModel.cachedLessons.Contains(lessonsViewModel.FirstDayOfWeek)) { lessonRealms = lessonsViewModel._lessonDataService.GetLessons(lessonsViewModel.ActiveProfileRealm.RolelessId, lessonsViewModel.FirstDayOfWeek, lessonsViewModel.LastDayOfWeek); } else { lessonRealms = await lessonsViewModel._lessonDataService.FetchLessonsAsync(lessonsViewModel.ActiveProfile, new DateTime?(lessonsViewModel.FirstDayOfWeek), new DateTime?(lessonsViewModel.LastDayOfWeek), true); lessonsViewModel._lessonDataService.OverrideLessons(lessonsViewModel.ActiveProfileRealm.RolelessId, lessonRealms, lessonsViewModel.FirstDayOfWeek, lessonsViewModel.LastDayOfWeek); lessonsViewModel.cachedLessons.Add(lessonsViewModel.FirstDayOfWeek); } IEnumerable <LessonRealm> lessons = (IEnumerable <LessonRealm>)lessonRealms.OrderBy <LessonRealm, DateTime>((Func <LessonRealm, DateTime>)(x => x.StartTimeLocal)); lessonsViewModel.ComposeLessons(lessons); } catch (Exception ex) { IEnumerable <LessonRealm> lessons = lessonsViewModel._lessonDataService.GetLessons(lessonsViewModel.ActiveProfileRealm.RolelessId, lessonsViewModel.FirstDayOfWeek, lessonsViewModel.LastDayOfWeek); if (lessons == null) { lessonsViewModel.ShowError(); } else { lessonsViewModel.ComposeLessons(lessons); lessonsViewModel.IsOffline = true; } } finally { lessonsViewModel.IsLoading = false; } }