private void buttonPlay_Click(object sender, EventArgs e) { if ((radioButtonAgainstComputer.Checked == true) || (radioButtonAgainstFriend.Checked == true) || (radioButton2Computers.Checked == true)) { if (radioButton2Computers.Checked == true) { LogicBackgammon.BackgammonManager.GameMode gameMode = LogicBackgammon.BackgammonManager.GameMode.TwoComputers; BackgammonForm gameForm = new BackgammonForm(gameMode, "First Computer", "Second Computer"); gameForm.ShowDialog(); this.Close(); } else if (!String.IsNullOrEmpty(textBoxPlayerName.Text)) { if (radioButtonAgainstFriend.Checked != true) { LogicBackgammon.BackgammonManager.GameMode gameMode = LogicBackgammon.BackgammonManager.GameMode.Computer; BackgammonForm gameForm = new BackgammonForm(gameMode, textBoxPlayerName.Text, "Computer"); gameForm.ShowDialog(); this.Close(); } else if (String.IsNullOrEmpty(textBoxFriendName.Text)) { MessageBox.Show("Please enter friend name!"); } else { LogicBackgammon.BackgammonManager.GameMode gameMode = LogicBackgammon.BackgammonManager.GameMode.Friend; BackgammonForm gameForm = new BackgammonForm(gameMode, textBoxPlayerName.Text, textBoxFriendName.Text); gameForm.ShowDialog(); this.Close(); } } else { MessageBox.Show("Please enter Your name!"); } } else { MessageBox.Show("Please choose game mode!"); } }
private void buttonPlay_Click(object sender, EventArgs e) { if((radioButtonAgainstComputer.Checked == true) || (radioButtonAgainstFriend.Checked == true) || (radioButton2Computers.Checked == true)) { if(radioButton2Computers.Checked == true) { LogicBackgammon.BackgammonManager.GameMode gameMode = LogicBackgammon.BackgammonManager.GameMode.TwoComputers; BackgammonForm gameForm = new BackgammonForm(gameMode, "First Computer", "Second Computer"); gameForm.ShowDialog(); this.Close(); } else if(!String.IsNullOrEmpty(textBoxPlayerName.Text)) { if(radioButtonAgainstFriend.Checked != true) { LogicBackgammon.BackgammonManager.GameMode gameMode = LogicBackgammon.BackgammonManager.GameMode.Computer; BackgammonForm gameForm = new BackgammonForm(gameMode, textBoxPlayerName.Text, "Computer"); gameForm.ShowDialog(); this.Close(); } else if(String.IsNullOrEmpty(textBoxFriendName.Text)) { MessageBox.Show("Please enter friend name!"); } else { LogicBackgammon.BackgammonManager.GameMode gameMode = LogicBackgammon.BackgammonManager.GameMode.Friend; BackgammonForm gameForm = new BackgammonForm(gameMode, textBoxPlayerName.Text, textBoxFriendName.Text); gameForm.ShowDialog(); this.Close(); } } else { MessageBox.Show("Please enter Your name!"); } } else { MessageBox.Show("Please choose game mode!"); } }