private async Task ExecuteNextWeekCommand()
        {
            HomeWorksViewModel homeWorksViewModel1 = this;
            DateTime           dateTime1           = homeWorksViewModel1.LastDayOfWeek.AddDays(7.0);

            if (dateTime1 <= DateTime.Today.LastDayOfWeek().AddDays(7.0))
            {
                HomeWorksViewModel homeWorksViewModel2 = homeWorksViewModel1;
                DateTime           dateTime2           = dateTime1.AddDays(2.0);
                DateTime           dateTime3           = DateTime.Today.LastDayOfWeek();
                DateTime           dateTime4           = dateTime3.AddDays(7.0);
                int num = dateTime2 != dateTime4 ? 1 : 0;
                homeWorksViewModel2.HasNextWeek = num != 0;
                HomeWorksViewModel homeWorksViewModel3 = homeWorksViewModel1;
                dateTime3 = homeWorksViewModel1.FirstDayOfWeek;
                DateTime dateTime5 = dateTime3.AddDays(7.0);
                homeWorksViewModel3.FirstDayOfWeek = dateTime5;
                HomeWorksViewModel homeWorksViewModel4 = homeWorksViewModel1;
                dateTime3 = homeWorksViewModel1.LastDayOfWeek;
                DateTime dateTime6 = dateTime3.AddDays(7.0);
                homeWorksViewModel4.LastDayOfWeek        = dateTime6;
                homeWorksViewModel1.LastDayOfWeekDisplay = homeWorksViewModel1.LastDayOfWeek;
                await homeWorksViewModel1.LoadHomeWorks(false);
            }
            else
            {
                homeWorksViewModel1.HasNextWeek = false;
            }
        }
        private async Task LoadHomeWorks(bool forceRefresh = false)
        {
            HomeWorksViewModel homeWorksViewModel = this;

            homeWorksViewModel.IsError   = false;
            homeWorksViewModel.IsLoading = true;
            if (homeWorksViewModel.SelectedItem != null)
            {
                homeWorksViewModel.IsLoading = false;
            }
            homeWorksViewModel.IsOffline = false;
            try
            {
                IEnumerable <LessonRealm> lessonRealms;
                if (!homeWorksViewModel.HasInternetConnection)
                {
                    lessonRealms = homeWorksViewModel._lessonDataService.GetLessons(homeWorksViewModel.ActiveProfileRealm.RolelessId, homeWorksViewModel.FirstDayOfWeek, homeWorksViewModel.LastDayOfWeek);
                    if (lessonRealms == null)
                    {
                        homeWorksViewModel.ShowError();
                    }
                }
                else if (homeWorksViewModel.cachedLessons.Contains(homeWorksViewModel.FirstDayOfWeek) && !forceRefresh)
                {
                    lessonRealms = homeWorksViewModel._lessonDataService.GetLessons(homeWorksViewModel.ActiveProfileRealm.RolelessId, homeWorksViewModel.FirstDayOfWeek, homeWorksViewModel.LastDayOfWeek);
                }
                else
                {
                    IEnumerable <LessonRealm> lessons = await homeWorksViewModel._lessonDataService.FetchLessonsAsync(homeWorksViewModel.ActiveProfile, new DateTime?(homeWorksViewModel.FirstDayOfWeek), new DateTime?(homeWorksViewModel.LastDayOfWeek), true);

                    homeWorksViewModel._lessonDataService.OverrideLessons(homeWorksViewModel.ActiveProfileRealm.RolelessId, lessons, homeWorksViewModel.FirstDayOfWeek, homeWorksViewModel.LastDayOfWeek);
                    lessonRealms = homeWorksViewModel._lessonDataService.GetLessons(homeWorksViewModel.ActiveProfileRealm.RolelessId, homeWorksViewModel.FirstDayOfWeek, homeWorksViewModel.LastDayOfWeek);
                    homeWorksViewModel.cachedLessons.Add(homeWorksViewModel.FirstDayOfWeek);
                }
                if (homeWorksViewModel.DoneHomeWorkFilterIsActive)
                {
                    lessonRealms = lessonRealms.Where <LessonRealm>((Func <LessonRealm, bool>)(x => !x.IsHomeworkDone));
                }
                homeWorksViewModel.ComposeHomeWorks(lessonRealms);
            }
            catch (Exception ex)
            {
                IEnumerable <LessonRealm> lessons = homeWorksViewModel._lessonDataService.GetLessons(homeWorksViewModel.ActiveProfileRealm.RolelessId, homeWorksViewModel.FirstDayOfWeek, homeWorksViewModel.LastDayOfWeek);
                if (lessons == null)
                {
                    homeWorksViewModel.ShowError();
                }
                else
                {
                    homeWorksViewModel.ComposeHomeWorks(lessons);
                    homeWorksViewModel.IsOffline = true;
                }
            }
            finally
            {
                homeWorksViewModel.IsLoading = false;
            }
        }
        private async Task ExecuteShowDetailCommand(LessonRealm lesson)
        {
            HomeWorksViewModel homeWorksViewModel = this;

            homeWorksViewModel._singleNavigation.DisableNavigation();
            if (lesson.IsTanuloHaziFeladatEnabled)
            {
                int num1 = await homeWorksViewModel._navigationService.Navigate <HomeWorkStudentDetailViewModel, LessonRealm>((M1)lesson, (IMvxBundle)null, new CancellationToken()) ? 1 : 0;
            }
            else
            {
                int num2 = await homeWorksViewModel._navigationService.Navigate <HomeWorkDetailViewModel, LessonRealm>((M1)lesson, (IMvxBundle)null, new CancellationToken()) ? 1 : 0;
            }
        }
        private async Task ExecutePreviousWeekCommand()
        {
            HomeWorksViewModel homeWorksViewModel1 = this;

            homeWorksViewModel1.HasNextWeek = true;
            HomeWorksViewModel homeWorksViewModel2 = homeWorksViewModel1;
            DateTime           dateTime1           = homeWorksViewModel1.FirstDayOfWeek;
            DateTime           dateTime2           = dateTime1.AddDays(-7.0);

            homeWorksViewModel2.FirstDayOfWeek = dateTime2;
            HomeWorksViewModel homeWorksViewModel3 = homeWorksViewModel1;

            dateTime1 = homeWorksViewModel1.LastDayOfWeek;
            DateTime dateTime3 = dateTime1.AddDays(-7.0);

            homeWorksViewModel3.LastDayOfWeek        = dateTime3;
            homeWorksViewModel1.LastDayOfWeekDisplay = homeWorksViewModel1.LastDayOfWeek;
            await homeWorksViewModel1.LoadHomeWorks(false);
        }