private void newButtonClicked(GameButton button) { Debug.Assert(activeButtons.Count <= 1); button.SetVisible(true); if (activeButtons.Count == 0) { activeButtons.Add(button); } else if (activeButtons.Count == 1) { if (activeButtons[0] == button) { return; } if (activeButtons[0].Num != button.Num) { button.Update(); System.Threading.Thread.Sleep(500); activeButtons[0].SetVisible(false); button.SetVisible(false); } else { activeButtons[0].Enabled = false; button.Enabled = false; } activeButtons.Clear(); } }
private Button GetGameButton(int num) { var button = new GameButton { Text = num.ToString(), Dock = DockStyle.Fill, Num = num, }; button.SetVisible(false); button.Click += (sender, args) => { button.Visible = true; newButtonClicked(button); }; button.Font = this._startButton.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(204))); return(button); }