private void btn_play_Click(object sender, EventArgs e) { myBoardGame.clearData(); myBoardGame.setAI(flagAI); // Save all data setting to Object. //saveSettingToObjectMyGame(); string size = ""; foreach (DataGridViewRow row in dataGridViewLoadBoard.SelectedRows) { setXMLToObjectGame(row.Cells[1].Value.ToString()); // name file is keyword. size = row.Cells[2].Value.ToString(); // size } //if (colorSectionA != Color.Transparent && colorSectionB != Color.Transparent) { // myBoardGame.setColorSection(colorSectionA, colorSectionB); //} myBoardGame.setColorSection(previewBoard.getColorSectionA(), previewBoard.getColorSectionB()); //myBoardGame.setColorSection(colorSectionA, colorSectionB); if (size == "8 x 8") { myBoardGame.backup(); FormPlay8x8 form = new FormPlay8x8(myBoardGame); form.Show(); Hide(); form.Location = this.Location; if (parentForm != null) { parentForm.Close(); } } else if (size == "12 x 12") { myBoardGame.backup(); FormPlay12x12 form = new FormPlay12x12(myBoardGame); form.Show(); Hide(); form.Location = this.Location; if (parentForm != null) { parentForm.Close(); } } }
private void btn_play_Click(object sender, EventArgs e) { // Save all data setting to Object. saveSettingToObjectMyGame(); string size = ""; string type = ""; foreach (DataGridViewRow row in dataGridViewLoadBoard.SelectedRows) { setXMLToObjectGame(row.Cells[1].Value.ToString()); // name file is keyword. size = row.Cells[2].Value.ToString(); // size type = row.Cells[0].Value.ToString(); } myBoardGame.backup(); // copy data for backup , when user restart board. if (flagAI && type == "Mak Horse") { MessageBox.Show("This feature is not support."); return; } if (size == "8 x 8") { //MetroMessageBox.Show(this, "Let Go!!!"); //FormPlay8x8 form = new FormPlay8x8(myBoardGame); this.Enabled = false; FormChooseStarter form = new FormChooseStarter(this, myBoardGame); form.Show(); //Hide(); form.Location = new Point(this.Location.X + (this.Width / 2) - (form.Size.Width / 2), this.Location.Y + (this.Height / 2) - (form.Size.Height / 2)); } else if (size == "12 x 12") { this.Enabled = false; FormChooseStarter form = new FormChooseStarter(this, myBoardGame); form.Show(); //Hide(); form.Location = new Point(this.Location.X + (this.Width / 2) - (form.Size.Width / 2), this.Location.Y + (this.Height / 2) - (form.Size.Height / 2)); } else { MessageBox.Show("This feature is not support."); } }