Ejemplo n.º 1
0
 public static ProgramAdditionForm GetInstance()
 {
     if (s_Instance == null)
     {
         s_Instance              = new ProgramAdditionForm();
         s_Instance.FormClosing += OnFormClosing;
     }
     return(s_Instance);
 }
Ejemplo n.º 2
0
        private void btnAddProgram_Click(object sender, EventArgs e)
        {
            ProgramAdditionForm form = ProgramAdditionForm.GetInstance();

            if (!form.Visible)
            {
                form.Show();
            }
            else
            {
                form.BringToFront();
            }
        }
Ejemplo n.º 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;
 }