public void NewGame() { aTimer = new System.Timers.Timer(); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 1000; aTimer.Enabled = true; aTimer.SynchronizingObject = this; aTimer.Stop(); Timer = 0; Controls.Clear(); Height = ButtonSize * ButtonRows; Width = ButtonSize * ButtonRows; NumberBombs = Bombs; TextBombs = Bombs; NumberClickedCases = 0; IsGameOver = false; board = new Board(ButtonRows, ButtonCols); board.FillWithBombs(NumberBombs); CalculateBombsAroundEachCase(); DisplayBoard(board); Height = (ButtonSize * ButtonRows) + 250; Width = (ButtonSize * ButtonCols) + 20; foreach (var button in Controls.OfType <Button>()) { if (button.Name == "Replay") { button.Click += ReplayGame; } else { button.MouseUp += Button_Click; button.Click += Button_Click2; } } board.DisplayConsole(); }