From 09f7635b47b260ee45244a318bbd0fa2aab509d2 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 26 Dec 2019 22:02:12 -0600 Subject: [PATCH] Force prevent multiple profile editors from being created --- DS4Windows/DS4Forms/MainWindow.xaml.cs | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/DS4Windows/DS4Forms/MainWindow.xaml.cs b/DS4Windows/DS4Forms/MainWindow.xaml.cs index ca0e5ab..292e8cd 100644 --- a/DS4Windows/DS4Forms/MainWindow.xaml.cs +++ b/DS4Windows/DS4Forms/MainWindow.xaml.cs @@ -1275,19 +1275,23 @@ Suspend support not enabled.", true); private void ShowProfileEditor(int device, ProfileEntity entity = null) { - profOptsToolbar.Visibility = Visibility.Collapsed; - profilesListBox.Visibility = Visibility.Collapsed; + if (editor == null) + { + profOptsToolbar.Visibility = Visibility.Collapsed; + profilesListBox.Visibility = Visibility.Collapsed; - preserveSize = false; - oldSize.Width = Width; - oldSize.Height = Height; - this.Width = 1000; - this.Height = 650; - editor = new ProfileEditor(device); - editor.CreatedProfile += Editor_CreatedProfile; - editor.Closed += ProfileEditor_Closed; - profDockPanel.Children.Add(editor); - editor.Reload(device, entity); + preserveSize = false; + oldSize.Width = Width; + oldSize.Height = Height; + this.Width = 1000; + this.Height = 650; + editor = new ProfileEditor(device); + editor.CreatedProfile += Editor_CreatedProfile; + editor.Closed += ProfileEditor_Closed; + profDockPanel.Children.Add(editor); + editor.Reload(device, entity); + } + } private void Editor_CreatedProfile(ProfileEditor sender, string profile)