private void button2_Click(object sender, EventArgs e) { if (_singleInstanceForm == null) { _singleInstanceForm = new SingleInstance_MainForm(); _singleInstanceForm.Disposed += new EventHandler(_singleInstanceForm_Disposed); } _singleInstanceForm.Show(); }
void _singleInstanceForm_Disposed(object sender, EventArgs e) { _singleInstanceForm = null; }