Exemple #1
0
 private void UpdateBoardeGui(Button lb, BoardGui boardGui, ChessPieceSide side)
 {
     if (btnPlay.InvokeRequired)
     {
         // this is worker thread
         updateBoardDelegate del = new updateBoardDelegate(UpdateBoardeGui);
         lvChat.Invoke(del, new object[] { lb, boardGui, side });
     }
     else
     {
         // this is UI thread
         btnPlay.Visible = false;
         boardGui        = new BoardGui(side);
         this.Controls.Add(boardGui);
         this.boardGui = boardGui;
     }
 }
        private void UpdateBoardeGui(Button lb, BoardGui boardGui, ChessPieceSide side)
        {
            if (btnPlay.InvokeRequired)
            {
                // this is worker thread
                updateBoardDelegate del = new updateBoardDelegate(UpdateBoardeGui);
                btnPlay.Invoke(del, new object[] { lb, boardGui, side });
            }
            else
            {
                // this is UI thread
                btnPlay.Visible = false;
                if (Mode1AndMode2.namePlayer == "Player black")
                {
                    isClient = true;
                }

                boardGui = new BoardGui(side, isClient);
                this.Controls.Add(boardGui);
                this.boardGui = boardGui;
            }
        }