public frmPlay(int setupState)
        {
            InitializeComponent();
            this.chucNang = (menuChucNang)setupState;

            getData = new GetDAL();
            setData = new SetDAL();
        }
 private void btnSetup_Click(object sender, EventArgs e)
 {
     rdo1Player.Checked = rdo2Player.Checked = false;
     chucNang           = menuChucNang.setup;
     pnlPlay.Enabled    = false;
     if (!btnStart.Enabled)
     {
         this.board.TimeRun.Stop();
     }
     LoadGameBySetup();
 }
 void HienThiFormTheoChucNang(menuChucNang cn)
 {
     if (cn == menuChucNang.play1)
     {
     }
     else if (cn == menuChucNang.play2)
     {
     }
     else // (cn == menuChucNang.setup)
     {
     }
 }
        private void btnPlay_Click(object sender, EventArgs e)
        {
            btnStart.Enabled     = true;
            pnlPlay.Enabled      = false;
            btnIdea.Enabled      = false;
            btnResetGame.Enabled = false;

            if (rdo1Player.Checked)
            {
                chucNang = menuChucNang.play1;
            }
            else if (rdo2Player.Checked)
            {
                chucNang = menuChucNang.play2;
            }
            else
            {
                MessageBox.Show("Bạn hãy chọn số Players!!");
                return;
            }

            try
            {
                board.TimeRun.Stop();
                pnlPlay.Controls.Clear();
                int      ma      = (int)cboLevel.SelectedValue;
                LuotChoi lcdaluu = null;
                if ((int)this.chucNang == 1)
                {
                    lcdaluu = getData.GetLuotChoiDaLuu(ma);
                    if (lcdaluu != null)
                    {
                        List <Cell> lstCell = new List <Cell>();
                        lstCell = lcdaluu.Cells.ToList();

                        setData.DeleteLuotChoi(lcdaluu.maLuotChoi, lstCell);
                        LoadGameByGameSaved(ma, lstCell, (int)lcdaluu.thoiGian);
                    }
                    else
                    {
                        LoadGame(ma);
                    }
                }
                else //if ((int)this.chucNang == 2)
                {
                    LoadGame(ma);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }