Exemplo n.º 1
0
 private void loadStatsToUI(GetMyStatisticsResponse getMyStatisticsResponse)
 {
     TotalGamesTXT.Text  = "Total games you played: " + getMyStatisticsResponse.gamesPlayed;
     AverageTimeTXT.Text = "Average time for answer: " + getMyStatisticsResponse.averageAnswerTime;
     CorrectAnsTXT.Text  = "Correct Answers: " + getMyStatisticsResponse.correctAnswers;
     WrongAnsTXT.Text    = "Wrong Answers: " + getMyStatisticsResponse.wrongAnswers;
 }
Exemplo n.º 2
0
        public void getStats()
        {
            GetMyStatisticsRequest getMyStatisticsRequest = new GetMyStatisticsRequest();


            app.communicator.SocketSendReceive(JsonSerializer.serializeRequest(getMyStatisticsRequest, Constants.GET_MY_STATISTICS_REQUEST)).ContinueWith(task =>
            {
                ResponseInfo response = task.Result;
                GetMyStatisticsResponse getMyStatisticsResponse = JsonDeserializer.deserializeResponse <GetMyStatisticsResponse>(response.buffer);
                switch (getMyStatisticsResponse.status)
                {
                case Constants.GET_MY_STATISTICS_SUCCESS:
                    MyMessageQueue.Enqueue("Load Stats Successfully!");
                    this.Dispatcher.Invoke(() =>
                    {
                        loadStatsToUI(getMyStatisticsResponse);
                    });
                    break;
                }
            });
        }