public void Show() { if (window == null) { window = new UserPreferencesForm(userPreferences); window.FormClosed += OnWindowClosed; } if (window.Visible) { window.Focus(); } else { window.ShowDialog(); } }
private void OnWindowClosed(object sender, FormClosedEventArgs e) { window.Dispose(); window = null; }