コード例 #1
0
 public HomeWorkStudentDetailViewModel()
 {
     this._studentHomeWorkDataService = (IStudentHomeWorkDbDataService)Mvx.get_IoCProvider().Resolve <IStudentHomeWorkDbDataService>();
 }
コード例 #2
0
 public HomeWorkEditViewModel()
 {
     this._studentHomeWorkDataService = (IStudentHomeWorkDbDataService)Mvx.get_IoCProvider().Resolve <IStudentHomeWorkDbDataService>();
     this.SaveHomeWorkCommand         = new MvxAsyncCommand(new Func <Task>(this.ExecuteSaveHomeWorkCommand), (Func <bool>)null, false);
 }
コード例 #3
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>();
            }
        }