private void Iv_data_CardClick(object sender, CardClickEventArgs e)
        {
            if (e.Clicks == 1)
            {
                return;
            }
            var data = Iv_data.GetRowCellValue(e.RowHandle, "Id").ToString();

            XtraMessageBox.Show(data);
        }
Exemple #2
0
        private void HandPresenter_CardClick(object sender, CardClickEventArgs e)
        {
            var isValidMove = false;

            try
            {
                if (_activePlayer != _player1)
                {
                    return;
                }

                _gameService.AcceptCard((IFrenchSuitedCard)e.Card);
                _activePlayer.Hand.RemoveCard((IFrenchSuitedCard)e.Card);
                _player1HandPresenter.DisplayHand();
                this.richTextBox1.AppendText($"{_activePlayer.Name} played: {e.Card.Name}\n", _activePlayer.Colour);

                if (IsWinningMove(_activePlayer))
                {
                    if (IsWinningMove(_activePlayer))
                    {
                        EndGame(_activePlayer);
                        return;
                    }
                }

                isValidMove = true;
            }
            catch (InvalidMoveException exception)
            {
                MessageBox.Show(exception.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            if (isValidMove)
            {
                NextPlayer();
            }
        }