Пример #1
0
 public static HolidayManagerForm GetInstance()
 {
     if (s_Instance == null)
     {
         s_Instance              = new HolidayManagerForm();
         s_Instance.FormClosing += OnFormClosing;
     }
     return(s_Instance);
 }
Пример #2
0
        private void btnPublicHolidays_Click(object sender, EventArgs e)
        {
            HolidayManagerForm form = HolidayManagerForm.GetInstance();

            if (!form.Visible)
            {
                form.Show();
            }
            else
            {
                form.BringToFront();
            }
        }
Пример #3
0
 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;
 }