/// <summary> /// If the user wants to add a game to the mix. /// </summary> private void OnAddGameMenuClick(object sender, EventArgs e) { //If there already is an add game form open, do nothing. if (_AddGameForm != null) { return; } //Display a form where the user can enter game data. _AddGameForm = new AddGame(); _AddGameForm.Show(); //Subscribe to its events. _AddGameForm.Closing += OnAddGameFormClose; }
/// <summary> /// When the add game form has been closed. /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void OnAddGameFormClose(object o, EventArgs e) { //Redraw the boards. UpdateBoards(); //Unsubscribe from the control and close it. _AddGameForm.Closing -= OnAddGameFormClose; _AddGameForm = null; }