Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent duplicate settings windows at once #1415

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading