/// <summary> /// Handles the Click event of the AnswerPicBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void AnswerPicBox_Click(object sender, EventArgs e) { //gets the random state, sets the state text box CountryTxtBox.Text = cGame.GetCountry(); //initializes game features when user presses start CapitalListBox.Enabled = true; TimeLeftTmr.Start(); AnswerPicBox.Enabled = false; AnswerLbl.Text = "Select the Capital!"; AnswerLbl.Text = ""; AnswerPicBox.Image = null; }
/// <summary> /// Handles the Click event of the Options_NewGame control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void Options_NewGame_Click(object sender, EventArgs e) { //resets all fields for new game CapitalListBox.Enabled = false; currentAttempts = 0; AttemptsBox.Text = currentAttempts.ToString(); currentCorrect = 0; CorrectBox.Text = currentCorrect.ToString(); currentTime = 15; TimeLeftTxtBox.Text = currentTime.ToString(); AnswerLbl.Text = "Click to Start"; AnswerPicBox.Image = CapitalGame.Properties.Resources.start; AnswerPicBox.Enabled = true; StateTxtBox.Text = sGame.GetState(); TimeLeftTmr.Stop(); }
/// <summary> /// Handles the Click event of the Regions_Europe control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void Regions_Europe_Click(object sender, EventArgs e) { //resets game stats and hides this window, sets currentGame to false this.Hide(); currentGame = false; currentAttempts = 0; AttemptsBox.Text = currentAttempts.ToString(); currentCorrect = 0; CorrectBox.Text = currentCorrect.ToString(); currentTime = 15; TimeLeftTxtBox.Text = currentTime.ToString(); AnswerPicBox.Image = CapitalGame.Properties.Resources.start; AnswerLbl.Text = "Click to Start"; AnswerPicBox.Enabled = true; TimeLeftTmr.Stop(); //opens the European game window CountryGameForm cGame = new CountryGameForm(this); cGame.Show(); }
/// <summary> /// Handles the Load event of the GameForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void GameForm_Load(object sender, EventArgs e) { //sets this as the current game currentGame = true; //populates list box with state capitals foreach (var item in sGame.CapitalKeys) { CapitalListBox.Items.Add(item); } //initializes other fields currentTime = 15; AttemptsBox.Text = currentAttempts.ToString(); CorrectBox.Text = currentCorrect.ToString(); TimeLeftTxtBox.Text = currentTime.ToString(); //pauses game features until user presses start CapitalListBox.Enabled = false; TimeLeftTmr.Stop(); }
private Boolean endGame = true; //holds whether or not the game is completely over /// <summary> /// Initializes a new instance of the <see cref="StateGameForm"/> class. /// </summary> public CountryGameForm(Form form) { InitializeComponent(); stateForm = form; TimeLeftTmr.Stop(); }