コード例 #1
0
ファイル: Trivia.xaml.cs プロジェクト: amasolini/brid-wp
        private void SetAnswerCallCompleted(Entities.ApiResponse obj)
        {
            SetAnswerLogResponse resp = obj.GetTypedResponse<SetAnswerLogResponse>();

            if (resp.anscorrect)
            {
                
                var dialog = new MessageDialog(String.Format("Respuesta Correcta!. Tiempo {0} segundos.", segundosEnResponder));
                dialog.ShowAsync();
            }
            else
            {
                var dialog = new MessageDialog(String.Format("Respuesta incorrecta!. Tiempo {0} segundos.", segundosEnResponder));
                dialog.ShowAsync();
            }

            segundosEnResponder = 0;
            stackOptions.Children.Clear();
            txtQuestion.Text = "Esperando próxima pregunta...";
            timer.Start();

        }
コード例 #2
0
ファイル: Trivia.xaml.cs プロジェクト: amasolini/brid-wp
        private async void CallCompleted(Entities.ApiResponse obj)
        {
            try
            {
                answerReceived = DateTime.Now;

                if (obj.JsonResponse != "null")
                {
                    GetGameQuestionsResponse response = obj.GetTypedResponse<GetGameQuestionsResponse>();
                    //stackOptions.Children.Add()
                    timer.Stop();

                    if (response.qid == 100)
                    {

                        var dialog = new MessageDialog("El juego ha finalizado. Chequea el ranking para ver si estas entre los 10 ganadores!");
                        dialog.Commands.Add(new UICommand { Label = "Volver", Id = 0 });

                        // Handles the messagedialog answer.
                        var res = await dialog.ShowAsync();
                        if ((int)res.Id == 0)
                        {
                            Frame.Navigate(typeof(Home));
                            return;
                        }
                    }

                    if (response.answers.Count > 0)
                    {
                        txtQuestion.Text = response.des;
                        BotonTrivia btnTrivia;

                        foreach (GetGameAnswersResponse answer in response.answers)
                        {
                            btnTrivia = new BotonTrivia();

                            btnTrivia.Content = answer.des;
                            btnTrivia.Name = "btnAnswer" + answer.aid;
                            btnTrivia.IsCorrect = (answer.anscorrect == 1);
                            btnTrivia.AnswerId = answer.aid;
                            btnTrivia.QuestionId = answer.qid;

                            var padding = new Thickness();
                            padding.Left = 10;
                            padding.Right = 10;
                            btnTrivia.Margin = padding;

                            btnTrivia.Click += btnTrivia_Click;

                            stackOptions.Children.Add(btnTrivia);
                        }

                    }
                    else
                    {
                        if (!timer.IsEnabled)
                        {
                            timer.Start();
                        }
                    }
                }
                else
                {
                    stackOptions.Children.Clear();
                    txtQuestion.Text = "Esperando próxima pregunta...";
                    timer.Start();
                }
                    

            }
            catch (Exception)
            {

                throw;
            }


        }