public void OnButtonPress() { if (_settingsWindow == null) { _settingsWindow = new SettingsWindow(Settings); _settingsWindow.PluginWindow = _mainWindow; _settingsWindow.Closed += (sender, args) => { _settingsWindow = null; }; _settingsWindow.Show(); } else { _settingsWindow.Activate(); } }