Example #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;
                    });
                }
            }
        }
        public AnswerPage(CurrentQoestion nextQuestion)
        {
            InitializeComponent();

            this.nextQuestion  = nextQuestion;
            httpService        = new httpService();
            answer1Button.Text = nextQuestion.questionAnswers[0].answerText;
            answer2Button.Text = nextQuestion.questionAnswers[1].answerText;
            answer3Button.Text = nextQuestion.questionAnswers[2].answerText;
            answer4Button.Text = nextQuestion.questionAnswers[3].answerText;
        }
Example #3
0
        public App()
        {
            InitializeComponent();

            curerrentQuestion = new CurrentQoestion("0", "", new QuestionAnswer[] { }, "", "");
            httpServices      = new httpService();
            TimeSpan ts = new TimeSpan(0, 0, 5);

            MainPage page = new MainPage();

            MainPage = new NavigationPage(page);
            //   MainPage = new MainPage();
        }