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>(); } }
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>(); } }