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(); panelChessBoad.Enabled = false; })); break; case (int)SocketCommand.SEND_POINT: this.Invoke((MethodInvoker)(() => { progressBarCoolDown.Value = 0; panelChessBoad.Enabled = true; tmCoolDown.Start(); chessBoardManager.OtherPlayerMark(data.Point); undoToolStripMenuItem.Enabled = true; })); break; case (int)SocketCommand.UNDO: chessBoardManager.Undo(); progressBarCoolDown.Value = 0; break; case (int)SocketCommand.END_GAME: tmCoolDown.Stop(); MessageBox.Show(data.Message + " Thắng cuộc"); EndGame(); break; case (int)SocketCommand.TIME_OUT: string name = chessBoardManager.Players[chessBoardManager.CurrentPlayer == 1 ? 0 : 1].Name; tmCoolDown.Stop(); MessageBox.Show(name + " Thắng cuộc"); EndGame(); break; case (int)SocketCommand.QUIT: tmCoolDown.Stop(); MessageBox.Show("Người chơi đã thoát"); break; default: break; } Listern(); }
void Undo() { chessBoardManager.Undo(); }