//----------------------------------------------------------------------------------- #endregion #region Menu Item Click Events //-------------------------------Menu Item Click Events -------------------------------- /// <summary> /// Creates and opens a new scoresForm object using singleton pattern. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void scoresMItem_Click(object sender, EventArgs e) { if (scoresForm == null) { scoresForm = new ScoresForm(); scoresForm.Closed += scores_closed; scoresForm.Show(); } }
/// <summary> /// Constructor initializes objects /// </summary> public GameForm() { InitializeComponent(); this.MaximizeBox = false; this.FormBorderStyle = FormBorderStyle.Fixed3D; scoresForm = null; bGameIsRunning = false; timer = new Timekeeper(); //timeThread = new Thread(stopWatch); }
/// <summary> /// Resets the scoresForm object to null, completing singleton. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void scores_closed(object sender, EventArgs e) { scoresForm = null; }