Exemplo n.º 1
0
        public async Task AddPlayerAsync(Player player)
        {
            isPending = true;
            ErrorMessege = null;

            try
            {
                IMobileServiceTable<Player> Table = _client.GetTable<Player>();
                await Table.InsertAsync(player);
                Players.Add(player);
            }

            catch (MobileServiceInvalidOperationException ex) { ErrorMessege = ex.Message; }
            catch (HttpRequestException ex) { ErrorMessege = ex.Message; }
            finally { isPending = false; }
        }
Exemplo n.º 2
0
        public async Task SubmitReusltAsync(Player player, int playerScore, int robotScore)
        {
            isPending = true;
            ErrorMessege = null;

            PlayerResult playerResult = new PlayerResult { Id = player.Id, PlayerScore = playerScore, RobotScore = robotScore };

            try
            {
                await _client.InvokeApiAsync<PlayerResult, object>("Result", playerResult);
                await GetAllRanksAsync();
            }

            catch (MobileServiceInvalidOperationException ex) { ErrorMessege = ex.Message; }
            catch (HttpRequestException ex) { ErrorMessege = ex.Message; }
            finally { isPending = false; }
        }