Skip to content

Commit

Permalink
Prevent duplicate settings windows at once (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
williambohrmann3 authored Mar 11, 2024
1 parent d2bea9c commit 03d4d25
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/WPF/WPF.Viewer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class MainWindow
private List<TreeViewItem> _samples;
private System.Windows.Forms.Timer _delaySearchTimer;
private const int _delayedTextChangedTimeout = 500;
private bool _settingsWindowOpen;

private List<string> _namedUserSamples = new List<string> {
"AuthorMap",
Expand Down Expand Up @@ -466,6 +467,8 @@ private bool SampleSearchFunc(SampleInfo sample)

private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
if (_settingsWindowOpen) return;
_settingsWindowOpen = true;
SettingsWindow settingsWindow = new SettingsWindow();
settingsWindow.Owner = this;
settingsWindow.Closing += SettingsWindow_Closing;
Expand Down Expand Up @@ -606,6 +609,8 @@ private void SettingsWindow_Closing(object sender, System.ComponentModel.CancelE
SetScreenshotButttonVisibility();
SetContainerDimensions();

_settingsWindowOpen = false;

// Reactivate the parent window so that it does not minimize on close.
Activate();
}
Expand Down

0 comments on commit 03d4d25

Please sign in to comment.