From ad4b36771b4db5317a75dccee5ebbbf705ff0b38 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sun, 12 Nov 2017 00:19:04 -0500 Subject: [PATCH 1/2] Fixes being unable to repon a closed ControlPanel --- TGControlPanel/ControlPanel/ControlPanel.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/TGControlPanel/ControlPanel/ControlPanel.cs b/TGControlPanel/ControlPanel/ControlPanel.cs index 146fb047f9..5149d22b5b 100644 --- a/TGControlPanel/ControlPanel/ControlPanel.cs +++ b/TGControlPanel/ControlPanel/ControlPanel.cs @@ -29,6 +29,7 @@ namespace TGControlPanel public ControlPanel(IInterface I) { InitializeComponent(); + FormClosed += ControlPanel_FormClosed; Interface = I; if (Interface.IsRemoteConnection) { @@ -46,13 +47,22 @@ namespace TGControlPanel UpdateSelectedPanel(); InstancesInUse.Add(I.InstanceName, this); } - + + /// + /// Called when the is closed + /// + /// The sender of the event + /// The + void ControlPanel_FormClosed(object sender, FormClosedEventArgs e) + { + InstancesInUse.Remove(Interface.InstanceName); + } + /// /// Called from /// void Cleanup() { - InstancesInUse.Remove(Interface.InstanceName); Interface.Dispose(); } From cd5ffeb2bb315df4692dec4e826317b011cbadc4 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Sun, 12 Nov 2017 00:19:55 -0500 Subject: [PATCH 2/2] Remove ControlPanel from cache in Cleanup --- TGControlPanel/ControlPanel/ControlPanel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TGControlPanel/ControlPanel/ControlPanel.cs b/TGControlPanel/ControlPanel/ControlPanel.cs index 5149d22b5b..dfdc564de0 100644 --- a/TGControlPanel/ControlPanel/ControlPanel.cs +++ b/TGControlPanel/ControlPanel/ControlPanel.cs @@ -63,6 +63,7 @@ namespace TGControlPanel /// void Cleanup() { + InstancesInUse.Remove(Interface.InstanceName); Interface.Dispose(); }