private bool colorWasChosen(ButtonColorForm buttonColorForm) { bool check = false; foreach (Button button in m_GuessButtons) { if (button.BackColor == buttonColorForm.color) { return(true); } } return(check); }
private void guessButton_Click(object sender, EventArgs e) { Button Buttonclicked = sender as Button; ButtonColorForm buttonColorForm = new ButtonColorForm(); buttonColorForm.ShowDialog(); if (!colorWasChosen(buttonColorForm)) { Buttonclicked.BackColor = buttonColorForm.color; Buttonclicked.Name = buttonColorForm.Name; if (Checker.GrayButtonChecker(m_GuessButtons)) { m_PointerToAccuracy.ForeColor = Color.Black; m_PointerToAccuracy.Enabled = true; } } }