private void NewGameButton_Click(object sender, EventArgs e) { foreach (var item in this.Controls) { // reset blocks if (item.GetType() == typeof(BrikksPictureBox)) { BrikksPictureBox box = (BrikksPictureBox)item; if (box.Name.StartsWith("Block__")) { box.Image = box.OriginalImage; box.IsMarked = false; box.IsFixed = false; } } // reset bombs else if (item.GetType() == typeof(BrikksBombButton)) { BrikksBombButton button = (BrikksBombButton)item; button.BombUsed = false; button.Enabled = true; button.Text = button.BombValue.ToString(); } // reset score lines else if (item.GetType() == typeof(BrikksScoreLineLabel)) { BrikksScoreLineLabel label = (BrikksScoreLineLabel)item; label.Text = "__"; } } DiceResultPictureBox.Image = null; }
private void FixAllMarkedBoxes() { foreach (var item in this.Controls) { if (item.GetType() == typeof(BrikksPictureBox)) { BrikksPictureBox box = (BrikksPictureBox)item; if (box.Name.StartsWith("Block__") && box.IsMarked && !box.IsFixed) { box.IsFixed = true; } } } }