/// <summary> /// When the settings form window is closed, make sure the variable /// is set to null and the object is collected by the garbage collector. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e) { _settingsForm = null; }
/// <summary> /// Shows the "Settings" windows form for Web Connectivity Checker when the /// settings menu item is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SettingsMenuItem_Click(object sender, EventArgs e) { if (_settingsForm == null) { _settingsForm = new SettingsForm(); _settingsForm.FormClosed += SettingsForm_FormClosed; _settingsForm.Show(); } else { _settingsForm.Activate(); } }
/// <summary> /// Closes and reopens the settings form. Used when checking the network status /// and the settings menu is open. /// </summary> private void ReopenSettingsForm() { if (_settingsForm != null) { _settingsForm.Close(); _settingsForm = new SettingsForm(); _settingsForm.FormClosed += SettingsForm_FormClosed; _settingsForm.Show(); } }