コード例 #1
0
        private async void SetPlayerStatus(PlayerOfMatch player, int playingStatus)
        {
            int?previousPlayingStatus = player.PlayingStatus;

            if (previousPlayingStatus == playingStatus)
            {
                return;
            }

            player.PlayingStatus = playingStatus;

            if (previousPlayingStatus < 3)
            {
                if (await _viewModel.UpdatePlayerOfMatch(player))
                {
                    ModifyPlayersOfMatch(player);
                }
                else
                {
                    player.PlayingStatus = previousPlayingStatus;
                }
            }
            else
            {
                if (await _viewModel.AddPlayerOfMatch(player))
                {
                    await _viewModel.GetPlayersOfMatchAsync(_viewModel.SelectedLiveMatch);
                }
                else
                {
                    player.PlayingStatus = previousPlayingStatus;
                }
            }
        }