public Event.Game.ValidMovesEvent requestValidMoves(Event.Game.RequestValidMovesEvent e)
        {
            bool isPlaying = this.gameMachine.getPlayers()[e.PlayerId()].getCurrentState().GetType().Equals(typeof(PlayerPlayingState));
            if (isPlaying)
            { 
                int r = e.getPositionDetail().getRow();
                int c = e.getPositionDetail().getCol();
                List<Position> validPositions = this.gameMachine.getBoardMachine().getBoard().getPieces()[r, c].getValidNextPositions();

                List<PositionDetail> pDetails = new List<PositionDetail>();
                foreach (Position p in validPositions)
                {
                    PositionDetail pd = new PositionDetail(p.getRow(), p.getCol());
                    pDetails.Add(pd);
                }

                return new ValidMovesEvent(pDetails);
            }

            return ValidMovesEvent.notFound();
        }
 public RequestPlayerMoveEvent(int pid, PositionDetail curr, PositionDetail next)
 {
     this.pid = pid;
     this.currentPosition = curr;
     this.nextPosition = next;
 }
        void item_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            TouchItem item = (TouchItem)sender;

            if (!item.isVisibleForTouch())
            {
                return;
            }

            PositionDetail pDetail = new PositionDetail(item.R, item.C);
            ValidMovesEvent validMovesEvent = gameService.requestValidMoves(new RequestValidMovesEvent(pDetail, 1));

            if (validMovesEvent.isAccepted())
            {
                this.RemoveMasks();
                item.setVisibleForTouch(true);

                List<PositionDetail> pDetails = validMovesEvent.getValidMoves();

                foreach (PositionDetail dt in pDetails)
                {
                    touchItems[dt.getRow(), dt.getCol()].setVisibleForTouch(true);
                }

            }
            else
            {
                MessageBox.Show("Not your turn");
            }

        }
 public RequestValidMovesEvent(PositionDetail positionDetail, int playerId)
 {
     this.positionDetail = positionDetail;
     this.playerId = playerId;
 }
 public RequestGameMoveEvent(int pid, PositionDetail cPos, PositionDetail nPos)
 {
     this.pid = pid;
     this.cPos = cPos;
     this.nPos = nPos;
 }