/// <summary> /// Adds a profile to the profile button list /// </summary> /// <param name="p">profile to add</param> /// <returns> /// returns the button used to select the profile specified. /// </returns> protected Button AddProfile(Profile p) { RedFlatButton b = new RedFlatButton(); b.Text = Profile.GetProfileNameParts(p.Name)[1]; b.BackColor = ButtonColors.Normal; b.Dock = DockStyle.Top; b.Click += new EventHandler(ProfileButton_Click); pProfileButtons.Controls.Add(b); return(b); }
/// <summary> /// Clears all the profile buttons and makes sure that all references to the buttons are null /// </summary> private void ClearProfileButtons() { foreach (Control c in pProfileButtons.Controls) { RedFlatButton button = c as RedFlatButton; if (button != null) { button.Click -= new EventHandler(ProfileButton_Click); } } pProfileButtons.Controls.Clear(); SelectedProfileButton = null; CustomProfile = null; }