Exemplo n.º 1
0
        private async void FinishClick()
        {
            //отравка последнего ответа на сервер
            var result = await server.SaveAnswer(new OSSAnswer()
            {
                Answer = _oss.Questions[quest].Answer, QuestionId = _oss.Questions[quest].ID
            });

            if (!string.IsNullOrWhiteSpace(result.Error))
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await DisplayAlert(AppResources.ErrorTitle, result.Error, "OK");
                    return;
                });
            }
            else
            {
                //отправка результата на сервер
                var resultComplite = await server.CompleteVote(_oss.ID);

                if (resultComplite.Error == null)
                {
                    await DisplayAlert(AppResources.AlertSuccess, AppResources.SuccessOSSPollPass, "OK");

                    if (Navigation.NavigationStack.FirstOrDefault(x => x is OSSPersonalVotingResult) == null)
                    {
                        await Navigation.PushAsync(new OSSPersonalVotingResult(_oss, true));
                    }
                    Navigation.RemovePage(this);
                }
                else
                {
                    await DisplayAlert(AppResources.ErrorTitle, $"{AppResources.ErrorOSSPollPass}\n" + result.Error, "OK");
                }
            }
        }