//--------- game button functions ------- // Pause the game by menu bar. private void PauseToolStripMenuItem_Click(object sender, EventArgs e) { if (gameSelect != null && gameSelect != "") { if ((string)Mytime.Tag == "Open") { Mytime.Stop(); Mytime.Tag = "Close"; GameBoard.Visible = false; PauseButton.Text = "Continue"; pauseToolStripMenuItem.Text = "Continue"; } else { Mytime.Start(); Mytime.Tag = "Open"; GameBoard.Visible = true; PauseButton.Text = "Pause"; pauseToolStripMenuItem.Text = "Pause"; } } }
// Display Win information. private void WinInfoDisplay() { string username; TextBox c = new TextBox(); c.Font = new Font("Microsoft Sans Serif", 15); c.Text = "You win!! \n" + "Your Score is: " + theController.GetGameScore(minutes, seconds); c.ForeColor = Color.LightCoral; c.Visible = true; c.Location = new Point(50, 200); c.Size = new Size(400, 96); c.TextAlign = HorizontalAlignment.Center; GameBoard.Controls.Clear(); GameBoard.Controls.Add(c); Mytime.Stop(); ScoreMessage.Visible = true; username = ShowDialog("Please enter your name:", "username"); username = username.Replace(",", string.Empty); username = username == "" ? "No name" : username; ScoreMessage.Text = theController.ScoreList(username, theController.GetGameScore(minutes, seconds)); }