Exemplo n.º 1
0
        private async Task AddHomework()
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel = this;

            if (!studentDetailViewModel.HasInternetConnection)
            {
                // ISSUE: reference to a compiler-generated method
                ((MvxMainThreadDispatchingObject)studentDetailViewModel).InvokeOnMainThread(new Action(studentDetailViewModel.\u003CAddHomework\u003Eb__31_0), true);
            }
            else
            {
                TanuloHaziFeladatCreateResponse feladatCreateResponse = await(Task <TanuloHaziFeladatCreateResponse>) studentDetailViewModel._navigationService.Navigate <HomeWorkEditViewModel, LessonRealm, TanuloHaziFeladatCreateResponse>((M1)studentDetailViewModel.Lesson, (IMvxBundle)null, new CancellationToken());
                if (feladatCreateResponse == null)
                {
                    return;
                }
                try
                {
                    await studentDetailViewModel.RefreshLesson(feladatCreateResponse.HozzaadottTanuloHaziFeladatId);
                }
                catch (Exception ex)
                {
                    ErrorHandler.Current.HandleError(ex);
                }
            }
        }
Exemplo n.º 2
0
        private async Task RefreshLesson(int newStudentHomeWorkId)
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel1 = this;

            try
            {
                HomeWorkStudentDetailViewModel studentDetailViewModel = studentDetailViewModel1;
                studentDetailViewModel1.Busy();
                // ISSUE: reference to a compiler-generated method
                LessonRealm currentLesson = (await studentDetailViewModel1._lessonDataService.FetchLessonsAsync(studentDetailViewModel1.ActiveProfile, new DateTime?(studentDetailViewModel1.Lesson.Date.DateTime), new DateTime?(studentDetailViewModel1.Lesson.Date.DateTime.AddDays(1.0)), true)).FirstOrDefault <LessonRealm>(new Func <LessonRealm, bool>(studentDetailViewModel1.\u003CRefreshLesson\u003Eb__26_0));
                if (currentLesson != null)
                {
                    ((MvxMainThreadDispatchingObject)studentDetailViewModel1).InvokeOnMainThread((Action)(() =>
                    {
                        studentDetailViewModel.Lesson = currentLesson;
                        ((MvxNotifyPropertyChanged)studentDetailViewModel).RaisePropertyChanged("Lesson");
                        studentDetailViewModel._messenger.Publish <LessonChangedMessage>((M0) new LessonChangedMessage((object)studentDetailViewModel, currentLesson));
                    }), true);
                    await studentDetailViewModel1.UpdateStudentHomeWorkListWithNewHomeWork(newStudentHomeWorkId, currentLesson);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Current.HandleError(ex);
            }
            finally
            {
                studentDetailViewModel1.NotBusy();
            }
        }
Exemplo n.º 3
0
        private async Task ExecuteDeleteHomeWorkCommand(StudentHomeWorkRealm homework)
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel = this;

            if (!studentDetailViewModel.HasInternetConnection)
            {
                // ISSUE: reference to a compiler-generated method
                ((MvxMainThreadDispatchingObject)studentDetailViewModel).InvokeOnMainThread(new Action(studentDetailViewModel.\u003CExecuteDeleteHomeWorkCommand\u003Eb__32_0), true);
            }
            else
            {
                string        text1          = studentDetailViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Message");
                string        text2          = studentDetailViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Title");
                string        text3          = studentDetailViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Confirm");
                string        text4          = studentDetailViewModel._textProvider.GetText((string)null, (string)null, "Common_Delete_Cancel");
                ConfirmConfig confirmConfig1 = new ConfirmConfig();
                confirmConfig1.set_Message(text1);
                confirmConfig1.set_Title(text2);
                confirmConfig1.set_OkText(text3);
                confirmConfig1.set_CancelText(text4);
                ConfirmConfig confirmConfig2 = confirmConfig1;
                if (studentDetailViewModel._platformStyleProvider != null)
                {
                    confirmConfig2.set_AndroidStyleId(new int?(studentDetailViewModel._platformStyleProvider.DeleteConfirmationStyle));
                }
                if (!await studentDetailViewModel._userDialogs.ConfirmAsync(confirmConfig2, new CancellationToken?()))
                {
                    return;
                }
                try
                {
                    studentDetailViewModel.IsHomeWorkLoading = true;
                    await studentDetailViewModel._studentHomeWorkDataService.DeleteStudentHomeWorkAsync(studentDetailViewModel.ActiveProfileRealm, int.Parse(homework.Id));

                    StudentHomeWorkRealm studentHomeWorkRealm = await studentDetailViewModel._studentHomeWorkDataService.FetchStudentHomeworkAsync(studentDetailViewModel.ActiveProfileRealm, int.Parse(homework.Id));

                    await studentDetailViewModel.InitStudentHomeWorks(studentDetailViewModel.Lesson);
                }
                catch (Exception ex)
                {
                    if (ex is ServerValidationException validationException)
                    {
                        await studentDetailViewModel._userDialogs.AlertAsync(validationException.ValidationException.GetAggregatedValidationMessage(), validationException.ValidationException.Message, studentDetailViewModel._textProvider.GetText((string)null, (string)null, "Alert_ButtonOk_Text"), new CancellationToken?());
                    }
                    else
                    {
                        ErrorHandler.Current.HandleError(ex);
                    }
                }
                finally
                {
                    studentDetailViewModel.IsHomeWorkLoading = false;
                }
            }
        }
Exemplo n.º 4
0
        private async Task UpdateStudentHomeWorkListWithNewHomeWork(
            int newStudentHomeWorkId,
            LessonRealm currentLesson)
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel = this;
            int num;

            if (num == 0 || currentLesson.TeacherHomeWorkId.HasValue)
            {
                try
                {
                    studentDetailViewModel.IsHomeWorkLoading = true;
                    studentDetailViewModel.IsOffline         = false;
                    if (!studentDetailViewModel._connectivity.get_IsConnected())
                    {
                        throw new NoInternetConnectionException().SetErrorCode <NoInternetConnectionException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", 117);
                    }
                    StudentHomeWorkRealm studentHomeWork = await studentDetailViewModel._studentHomeWorkDataService.FetchStudentHomeworkAsync(studentDetailViewModel.ActiveProfileRealm, newStudentHomeWorkId);

                    studentDetailViewModel._studentHomeWorkDataService.AddOrUpdate(studentDetailViewModel.ActiveProfileRealm.RolelessId, currentLesson.TeacherHomeWorkId.Value, studentHomeWork);
                    IEnumerable <StudentHomeWorkRealm> studentHomeworks = studentDetailViewModel._studentHomeWorkDataService.GetStudentHomeworks(studentDetailViewModel.ActiveProfileRealm.RolelessId, currentLesson.TeacherHomeWorkId.Value);
                    studentDetailViewModel.Homeworks = studentDetailViewModel.UpdateHomeWorksList(studentHomeworks);
                }
                catch (Exception ex)
                {
                    ex.SetErrorCode <Exception>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", (int)sbyte.MaxValue);
                    switch (ex)
                    {
                    case NoInternetConnectionException _:
                    case ServerUnreachableException _:
                        studentDetailViewModel.IsOffline = true;
                        studentDetailViewModel.ReloadHomeWorksFromDatabase();
                        break;
                    }
                }
                finally
                {
                    // ISSUE: reference to a compiler-generated method
                    ((MvxMainThreadDispatchingObject)studentDetailViewModel).InvokeOnMainThread(new Action(studentDetailViewModel.\u003CUpdateStudentHomeWorkListWithNewHomeWork\u003Eb__27_0), true);
                }
            }
            else
            {
                studentDetailViewModel.Homeworks = new List <StudentHomeWorkRealm>();
            }
        }
Exemplo n.º 5
0
        private async Task Refresh()
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel = this;

            try
            {
                if (!studentDetailViewModel.HasInternetConnection)
                {
                    throw new NoInternetConnectionException().SetErrorCode <NoInternetConnectionException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", 301);
                }
                await studentDetailViewModel.InitStudentHomeWorks(studentDetailViewModel.Lesson).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                ErrorHandler.Current.HandleError(ex);
            }
            finally
            {
                // ISSUE: reference to a compiler-generated method
                ((MvxMainThreadDispatchingObject)studentDetailViewModel).InvokeOnMainThread(new Action(studentDetailViewModel.\u003CRefresh\u003Eb__33_0), true);
            }
        }
Exemplo n.º 6
0
        private async Task InitStudentHomeWorks(LessonRealm lesson)
        {
            HomeWorkStudentDetailViewModel studentDetailViewModel = this;
            LessonRealm lessonRealm = lesson;
            int?        teacherHomeWorkId1;
            int         num;

            if (lessonRealm == null)
            {
                num = 0;
            }
            else
            {
                teacherHomeWorkId1 = lessonRealm.TeacherHomeWorkId;
                num = teacherHomeWorkId1.HasValue ? 1 : 0;
            }
            if (num != 0)
            {
                try
                {
                    studentDetailViewModel.IsHomeWorkLoading = true;
                    studentDetailViewModel.IsOffline         = false;
                    if (!studentDetailViewModel._connectivity.get_IsConnected())
                    {
                        throw new NoInternetConnectionException().SetErrorCode <NoInternetConnectionException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", 166);
                    }
                    IStudentHomeWorkDbDataService homeWorkDataService1 = studentDetailViewModel._studentHomeWorkDataService;
                    ProfileRealm activeProfileRealm = studentDetailViewModel.ActiveProfileRealm;
                    teacherHomeWorkId1 = lesson.TeacherHomeWorkId;
                    int teacherHomeWorkId2 = teacherHomeWorkId1.Value;
                    IEnumerable <StudentHomeWorkRealm> homeWork = await homeWorkDataService1.FetchStudentHomeWorksAsync(activeProfileRealm, teacherHomeWorkId2);

                    IStudentHomeWorkDbDataService homeWorkDataService2 = studentDetailViewModel._studentHomeWorkDataService;
                    string rolelessId = studentDetailViewModel.ActiveProfileRealm.RolelessId;
                    teacherHomeWorkId1 = lesson.TeacherHomeWorkId;
                    int teacherHomeWorkId3 = teacherHomeWorkId1.Value;
                    IEnumerable <StudentHomeWorkRealm> studentHomeWorks = homeWork;
                    homeWorkDataService2.OverrideStudentHomeWorks(rolelessId, teacherHomeWorkId3, studentHomeWorks);
                    studentDetailViewModel.Homeworks = studentDetailViewModel.UpdateHomeWorksList(homeWork);
                }
                catch (Exception ex)
                {
                    ex.SetErrorCode <Exception>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkStudentDetailViewModel.cs", 175);
                    switch (ex)
                    {
                    case NoInternetConnectionException _:
                    case ServerUnreachableException _:
                        studentDetailViewModel.IsOffline = true;
                        studentDetailViewModel.ReloadHomeWorksFromDatabase();
                        break;
                    }
                }
                finally
                {
                    // ISSUE: reference to a compiler-generated method
                    ((MvxMainThreadDispatchingObject)studentDetailViewModel).InvokeOnMainThread(new Action(studentDetailViewModel.\u003CInitStudentHomeWorks\u003Eb__29_0), true);
                }
            }
            else
            {
                studentDetailViewModel.Homeworks = new List <StudentHomeWorkRealm>();
            }
        }