void InfoFormClosed(object sender, FormClosedEventArgs args) { // detach the handler fI.FormClosed -= InfoFormClosed; // let GC collect it (and this way we can tell if it's closed) fI = null; }
private void buttonInfo_Click(object sender, EventArgs e) { // if the form is not closed, show it if (fI == null || fI.IsDisposed) { fI = new info(); // attach the handler fI.FormClosed += InfoFormClosed; } // show it fI.Show(); }
private void buttonInfo_Click(object sender, EventArgs e) { fI.label1Version.Text = this.Version; if (fI.Visible) { fI.Hide(); } else { if (fI.IsDisposed) { fI = new info(); } fI.Show(); } }
private void buttonInfo_Click(object sender, EventArgs e) { fI.label1Version.Text = this.Version; if (fI.Visible) fI.Hide(); else { if (fI.IsDisposed) fI = new info(); fI.Show(); } }