public static HolidayManagerForm GetInstance() { if (s_Instance == null) { s_Instance = new HolidayManagerForm(); s_Instance.FormClosing += OnFormClosing; } return(s_Instance); }
private void btnPublicHolidays_Click(object sender, EventArgs e) { HolidayManagerForm form = HolidayManagerForm.GetInstance(); if (!form.Visible) { form.Show(); } else { form.BringToFront(); } }
public static void OnFormClosing(object sender, FormClosingEventArgs e) { // When the form is closed again we set the reference of the singleton to null s_Instance = null; }