Ejemplo n.º 1
0
        public async void updateQuestionAsync()
        {
            System.Diagnostics.Debug.WriteLine("Task is invoked");

            nextQuestions = new List <CurrentQoestion>(await httpServices.LoadQuestion());
            nextQuestion  = nextQuestions[0]; //add somethimg
            if (curerrentQuestion.questionID != nextQuestion.questionID)
            {
                if (nextQuestion.questionIndex == App.game.gameLength)
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        App.game = await httpServices.GetGame();
                        if (App.game.gameStatus == "open")
                        {
                            //Task.

                            await MainPage.Navigation.PushAsync(new ResultPage(), true);
                            tokenSource.Cancel();
                        }
                    });
                }
                else
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await MainPage.Navigation.PushAsync(new AnswerPage(nextQuestion), true);
                        curerrentQuestion = nextQuestion;
                    });
                }
            }
        }