예제 #1
0
        private void ProcessData(SocketData data)
        {
            switch (data.Command)
            {
            case (int)SocketCommand.NOTIFY:
                MessageBox.Show(data.Message);
                break;

            case (int)SocketCommand.SEND_POINT:
                this.Invoke((MethodInvoker)(() =>
                {
                    tmCountDown.Start();
                    prbCountDown.Value = 0;
                    Caro.OthersPlayChess(data.MouseX, data.MouseY, grs);
                    pnlChessBoard.Enabled = true;
                    if (Caro.end)
                    {
                        tmCountDown.Stop();
                        prbCountDown.Value = 0;
                    }

                    btnNewGame.Enabled = true;
                    btnExit.Enabled = true;
                }));
                break;

            case (int)SocketCommand.NEW_GAME:
                this.Invoke((MethodInvoker)(() =>
                {
                    NewGame();
                    pnlChessBoard.Enabled = false;
                    Listen();
                }));
                break;

            case (int)SocketCommand.QUIT:
                this.Invoke((MethodInvoker)(() =>
                {
                    MessageBox.Show("The remaining player quit game !");
                    prbCountDown.Value = 0;
                    tmCountDown.Stop();
                }));
                break;

            case (int)SocketCommand.UNDO:
                this.Invoke((MethodInvoker)(() =>
                {
                    this.Caro.Undo(grs);
                    this.btnRedo.Enabled = true;
                }));
                Listen();
                break;

            case (int)SocketCommand.REDO:
                this.Invoke((MethodInvoker)(() =>
                {
                    this.Caro.Redo(grs);
                    this.btnRedo.Enabled = true;
                }));
                Listen();
                break;

            default:
                break;
            }
        }