private void ProcessData(SocketData data) { switch (data.Command) { case (int)SocketData.SocketCommand.NOTIFY: MessageBox.Show(data.Messages); break; case (int)SocketData.SocketCommand.SEND_POINT: this.Invoke( (MethodInvoker)(() => { progressBar.Value = 0; pnlChessBoard.Enabled = true; timer.Start(); chessBoard.OtherPlayerMark(data.Point); } )); break; case (int)SocketData.SocketCommand.UNDO: break; case (int)SocketData.SocketCommand.NEW_GAME: this.Invoke( (MethodInvoker)(() => { NewGame(); pnlChessBoard.Enabled = false; } )); break; case (int)SocketData.SocketCommand.END_GAME: break; case (int)SocketData.SocketCommand.QUIT: timer.Stop(); MessageBox.Show("Opponent has been gone"); break; default: break; } Listen(); }
private void ProcessData(SocketData data) { switch (data.Command) { case (int)SocketCommand.NOTIFY: MessageBox.Show(data.Message); break; case (int)SocketCommand.NEW_GAME: this.Invoke((MethodInvoker)(() => { newGame(); panelChessBoard.Enabled = false; })); break; case (int)SocketCommand.UNDO: Undo(); progressBar.Value = 0; break; case (int)SocketCommand.SEND_POINT: this.Invoke((MethodInvoker)(() => { progressBar.Value = 0; panelChessBoard.Enabled = true; timerCoolDown.Start(); ChessBoard.OtherPlayerMark(data.Point); undoToolStripMenuItem.Enabled = true; })); break; case (int)SocketCommand.END_GAME: MessageBox.Show("5 in a line!"); break; case (int)SocketCommand.TIME_OUT: MessageBox.Show("Time out!"); break; case (int)SocketCommand.QUIT: timerCoolDown.Stop(); MessageBox.Show("Player is out!"); break; default: break; } Listen(); }