예제 #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);
                }
            }
        }
        public async Task <TanuloHaziFeladatCreateResponse> CreateStudentHomeWorkAsync(
            ProfileRealm profile,
            LessonRealm lesson,
            string text)
        {
            TanuloHaziFeladatCreateResponse result;

            try
            {
                if (profile == null)
                {
                    throw new ArgumentNullException(nameof(profile));
                }
                TaskAwaiter <TanuloHaziFeladatCreateResponse> awaiter = this._mobileApi.CreateTanuloHaziFeladatAsync(profile, lesson, text).GetAwaiter();
                if (!awaiter.IsCompleted)
                {
                    int num;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003E1__state = num = 0;
                    TaskAwaiter <TanuloHaziFeladatCreateResponse> taskAwaiter = awaiter;
                    // ISSUE: explicit reference operation
                    // ISSUE: reference to a compiler-generated field
                    (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <TanuloHaziFeladatCreateResponse>, StudentHomeWorkDbDataService.\u003CCreateStudentHomeWorkAsync\u003Ed__5>(ref awaiter, this);
                    return;
                }
                TanuloHaziFeladatCreateResponse newHomeWork = awaiter.GetResult();
                if (!lesson.TeacherHomeWorkId.HasValue)
                {
                    this._lessonDataService.AddOrUpdate(lesson, (Action <LessonRealm>)(l => l.TeacherHomeWorkId = new int?(newHomeWork.TanarHaziFeladatId)));
                }
                result = newHomeWork;
            }
            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(result);
        }
예제 #3
0
        public async Task <TanuloHaziFeladatCreateResponse> CreateStudentHomeWorkAsync(
            Profile profile,
            Lesson lesson,
            string text)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }
            TanuloHaziFeladatCreateResponse haziFeladatAsync = await this._mobileApi.CreateTanuloHaziFeladatAsync(profile, lesson, text);

            if (!lesson.TeacherHomeWorkId.HasValue)
            {
                lesson.TeacherHomeWorkId = new int?(haziFeladatAsync.TanarHaziFeladatId);
                this._lessonDataService.AddOrUpdate(profile, lesson);
            }
            return(haziFeladatAsync);
        }