private void buttonClear_Click(object sender, RoutedEventArgs e) { MyField.ClearField(); ships = new Ships(beginShips); Group1.IsEnabled = true; groupBox.IsEnabled = true; buttonStartGame.IsEnabled = false; if (MyField.ClickOnBox == null) { MyField.ClickOnBox += MyField_ClickOnBox; } }
private void buttonNewGame_Click(object sender, RoutedEventArgs e) { groupBox.IsEnabled = true; groupBox1.IsEnabled = true; Group1.IsEnabled = true; buttonStartGame.IsEnabled = false; buttonNewGame.IsEnabled = false; buttonClear.IsEnabled = true; buttonAutoPlacement.IsEnabled = true; MyField.ClearField(); EnemyField.ClearField(); EnemyField.ClickOnBox -= EnemyField_ClickBox; MyField.ClickOnBox += MyField_ClickOnBox; }