private void btnProfile_Click(object sender, RoutedEventArgs e) { ConnectionProfiles window = new ConnectionProfiles(); window.Owner = MainWindow.Instance; // Show the profile manager if (window.ShowDialog().GetValueOrDefault(false)) { // if ok was pressed, reload the profiles SetupProfiles(); // and select the last one selected in the profile manager if (window.SelectedProfile != null) { SelectProfileByName(window.SelectedProfile.Name); } } }