示例#1
0
        public virtual async Task Initialize()
        {
            HomeWorkDetailViewModel workDetailViewModel = this;

            workDetailViewModel.HomeWorkNewItem();
            TeacherHomeWorkRealm teacherHomeWorkRealm = await workDetailViewModel.FetchTeacherHomeWork();

            workDetailViewModel.TeacherHomeWork = teacherHomeWorkRealm ?? new TeacherHomeWorkRealm();
            if (!workDetailViewModel.HasInternetConnection && workDetailViewModel.Lesson.HasHomework && (workDetailViewModel.TeacherHomeWork == null || workDetailViewModel.TeacherHomeWork != null && workDetailViewModel.TeacherHomeWork.Id == null))
            {
                string text = workDetailViewModel._textProvider.GetText((string)null, (string)null, "HomeWorkDetailCannotDownloadWOInternet");
                workDetailViewModel._userDialogs.Toast(text, new TimeSpan?(TimeSpan.FromSeconds(2.0)));
            }
            // ISSUE: reference to a compiler-generated method
            ((MvxMainThreadDispatchingObject)workDetailViewModel).InvokeOnMainThread(new Action(workDetailViewModel.\u003CInitialize\u003Eb__34_0), true);
        }
示例#2
0
        public async Task HomeWorkDoneChanged(bool done)
        {
            HomeWorkDetailViewModel workDetailViewModel = this;

            try
            {
                TaskAwaiter taskAwaiter;
                int         num;
                if (done != workDetailViewModel.HomeWorkDone)
                {
                    try
                    {
                        if (workDetailViewModel.ActiveProfile.IsTutelary)
                        {
                            TaskAwaiter awaiter = ((MvxNotifyPropertyChanged)workDetailViewModel).RaisePropertyChanged("HomeWorkDone").GetAwaiter();
                            if (!awaiter.IsCompleted)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003E1__state = num = 0;
                                taskAwaiter = awaiter;
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter, this);
                                return;
                            }
                            awaiter.GetResult();
                            awaiter = workDetailViewModel._modalDialog.DisplayAlertByResourceKeysAsync("HomeWorkDetail_Update_IsTutelary", "Common_NoInternet_Title").GetAwaiter();
                            if (!awaiter.IsCompleted)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003E1__state = num = 1;
                                taskAwaiter = awaiter;
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter, this);
                                return;
                            }
                            awaiter.GetResult();
                        }
                        else if (!workDetailViewModel.HasInternetConnection)
                        {
                            TaskAwaiter awaiter = ((MvxNotifyPropertyChanged)workDetailViewModel).RaisePropertyChanged("HomeWorkDone").GetAwaiter();
                            if (!awaiter.IsCompleted)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003E1__state = num = 2;
                                taskAwaiter = awaiter;
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter, this);
                                return;
                            }
                            awaiter.GetResult();
                            awaiter = workDetailViewModel._modalDialog.DisplayAlertByResourceKeysAsync("HomeWorkStudentDetail_Update_NoInternet", "Common_NoInternet_Title").GetAwaiter();
                            if (!awaiter.IsCompleted)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003E1__state = num = 3;
                                taskAwaiter = awaiter;
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter, this);
                                return;
                            }
                            awaiter.GetResult();
                        }
                        else
                        {
                            TaskAwaiter awaiter1 = workDetailViewModel._mobileApi.SaveTeacherHomeWorkDoneStatusAsync(workDetailViewModel.ActiveProfile, workDetailViewModel._teacherHomeWork.Id, done).GetAwaiter();
                            if (!awaiter1.IsCompleted)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003E1__state = num = 4;
                                taskAwaiter = awaiter1;
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter1, this);
                                return;
                            }
                            awaiter1.GetResult();
                            workDetailViewModel._teacherHomeWorkDbDataService.AddOrUpdate(workDetailViewModel.TeacherHomeWork, (Action <TeacherHomeWorkRealm>)(_teacherHomeWork => _teacherHomeWork.Done = done));
                            workDetailViewModel._lessonDataService.AddOrUpdate(workDetailViewModel.Lesson, (Action <LessonRealm>)(lesson => lesson.IsHomeworkDone = done));
                            TaskAwaiter awaiter2 = ((MvxNotifyPropertyChanged)workDetailViewModel).RaisePropertyChanged("HomeWorkDone").GetAwaiter();
                            if (!awaiter2.IsCompleted)
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003E1__state = num = 5;
                                taskAwaiter = awaiter2;
                                // ISSUE: explicit reference operation
                                // ISSUE: reference to a compiler-generated field
                                (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter2, this);
                                return;
                            }
                            awaiter2.GetResult();
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorHandler.Current.HandleError(ex);
                        TaskAwaiter awaiter = ((MvxNotifyPropertyChanged)workDetailViewModel).RaisePropertyChanged("HomeWorkDone").GetAwaiter();
                        if (!awaiter.IsCompleted)
                        {
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003E1__state = num = 6;
                            taskAwaiter = awaiter;
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter, HomeWorkDetailViewModel.\u003CHomeWorkDoneChanged\u003Ed__39>(ref awaiter, this);
                            return;
                        }
                        awaiter.GetResult();
                    }
                }
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult();
        }
示例#3
0
        private async Task <TeacherHomeWorkRealm> FetchTeacherHomeWork()
        {
            HomeWorkDetailViewModel workDetailViewModel = this;
            TeacherHomeWorkRealm    teacherHomeWork;
            TeacherHomeWorkRealm    result;

            try
            {
                teacherHomeWork = (TeacherHomeWorkRealm)null;
                try
                {
                    workDetailViewModel.IsOffline = false;
                    if (!workDetailViewModel._connectivity.get_IsConnected())
                    {
                        throw new NoInternetConnectionException().SetErrorCode <NoInternetConnectionException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkDetailViewModel.cs", 155);
                    }
                    if (workDetailViewModel.Lesson.TeacherHomeWorkId.HasValue)
                    {
                        TaskAwaiter <TeacherHomeWorkRealm> awaiter = workDetailViewModel._teacherHomeWorkDbDataService.FetchTeacherHomeWorkAsync(workDetailViewModel.ActiveProfileRealm, workDetailViewModel.Lesson.TeacherHomeWorkId.Value, true).GetAwaiter();
                        if (!awaiter.IsCompleted)
                        {
                            int num;
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003E1__state = num = 0;
                            TaskAwaiter <TeacherHomeWorkRealm> taskAwaiter = awaiter;
                            // ISSUE: explicit reference operation
                            // ISSUE: reference to a compiler-generated field
                            (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <TeacherHomeWorkRealm>, HomeWorkDetailViewModel.\u003CFetchTeacherHomeWork\u003Ed__36>(ref awaiter, this);
                            return;
                        }
                        teacherHomeWork = awaiter.GetResult();
                        workDetailViewModel._teacherHomeWorkDbDataService.SaveTeacherHomeWork(workDetailViewModel.ActiveProfileRealm.RolelessId, teacherHomeWork);
                    }
                    if (teacherHomeWork == null)
                    {
                        workDetailViewModel.CreateTanarHaziFeladatFromLesson();
                    }
                }
                catch (Exception ex)
                {
                    ex.SetErrorCode <Exception>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/ViewModels/HomeWorkDetailViewModel.cs", 171);
                    switch (ex)
                    {
                    case NoInternetConnectionException _:
                    case ServerUnreachableException _:
                        workDetailViewModel.IsOffline = true;
                        result = workDetailViewModel._teacherHomeWorkDbDataService.GetTeacherHomeWork(workDetailViewModel.Lesson);
                        goto label_14;
                    }
                }
                result = teacherHomeWork;
            }
            catch (Exception ex)
            {
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003E1__state = -2;
                teacherHomeWork = (TeacherHomeWorkRealm)null;
                // ISSUE: explicit reference operation
                // ISSUE: reference to a compiler-generated field
                (^ this).\u003C\u003Et__builder.SetException(ex);
                return;
            }
label_14:
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003E1__state = -2;
            teacherHomeWork = (TeacherHomeWorkRealm)null;
            // ISSUE: explicit reference operation
            // ISSUE: reference to a compiler-generated field
            (^ this).\u003C\u003Et__builder.SetResult(result);
        }