Пример #1
0
        private async void UpdateScore(object o, EventArgs e)
        {
            dynamic result = await client.DoGetAsync("games/" + GameID, "yes");

            if (result is HttpStatusCode)
            {
                MessageBox.Show("Error: " + result.ToString());
            }
            else if (result.GameState == "active")
            {
                Time.Text   = result.TimeLeft;
                Score1.Text = result.Player1.Score.ToString();
                Score2.Text = result.Player2.Score.ToString();
            }
            else if (result.GameState == "completed")
            {
                timer.Stop();
                Time.Text   = result.TimeLeft;
                Score1.Text = result.Player1.Score.ToString();
                Score2.Text = result.Player2.Score.ToString();
                foreach (dynamic d in result.Player1.WordsPlayed)
                {
                    Words1.AppendText(d.Word.ToString() + "   " + d.Score.ToString() + "\n");
                }
                foreach (dynamic d in result.Player2.WordsPlayed)
                {
                    Words2.AppendText(d.Word.ToString() + "   " + d.Score.ToString() + "\n");
                }
                RegisteredState();
            }
        }