/// <summary> /// Show and create a add goal form. /// </summary> /// <param name="profile">The profile that scored the goal.</param> private void ShowAddGoalForm(Profile profile) { //If there already is an add goal form open, do nothing. if (_AddGoalForm != null) { return; } //Create a form and show it to the user. _AddGoalForm = new AddGoal(profile); _AddGoalForm.Show(); //Subscribe to its events. _AddGoalForm.Button.Click += OnbtnAddGoalFormClick; _AddGoalForm.FormClosing += OnAddGoalFormClose; }
/// <summary> /// When the add game form closes. /// </summary> /// <param name="o"></param> /// <param name="e"></param> private void OnAddGoalFormClose(object o, EventArgs e) { //Unsubscribe from the control and close it. _AddGoalForm.Button.Click -= OnbtnAddGoalFormClick; _AddGoalForm.Closing -= OnAddGoalFormClose; _AddGoalForm = null; }