Esempio n. 1
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            //Example of how to use the proxy!
            TriviaWebAPIProxy proxy = TriviaWebAPIProxy.CreateProxy();
            AmericanQuestion  q     = await proxy.GetRandomQuestion();

            //tq.Wait();
            //AmericanQuestion q = tq.Result;
            User user = new User
            {
                Email    = "*****@*****.**",
                NickName = "testNickName",
                Password = "******"
            };
            bool tu = await proxy.RegisterUser(user);

            if (tu)
            {
                AmericanQuestion nq = new AmericanQuestion
                {
                    QText           = "Who is the founder of Testla?",
                    CorrectAnswer   = "Elon Musk",
                    OtherAnswers    = new string[] { "Steve Jobs", "Bill Gates", "George Constanza" },
                    CreatorNickName = "testNickName"
                };
                bool nqt = await proxy.PostNewQuestion(nq);

                if (nqt)
                {
                    bool dt = await proxy.DeleteQuestion(nq);
                }
            }
        }
Esempio n. 2
0
        async void RemoveQuestion(AmericanQuestion a)
        {
            if (QuestionList.Contains(a))
            {
                try
                {
                    TriviaWebAPIProxy proxy = TriviaWebAPIProxy.CreateProxy();
                    await proxy.DeleteQuestion(a);

                    QuestionList.Remove(a);
                }
                catch (Exception e) { }
            }
            Counter++;
            Able = true;
        }