void mainForm_FormClosed(object sender, FormClosedEventArgs e) { mainForm = null; }
//launches form if not already open private void launchMainForm() { if (mainForm == null) { mainForm = new MainForm(); mainForm.Show(); mainForm.FormClosed += new FormClosedEventHandler(mainForm_FormClosed); //make form null when closed } else mainForm.Activate(); }