From 3f00ffcec78215cdcd17c23f87c7a6719d032348 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 8 Nov 2017 13:58:45 -0500 Subject: [PATCH] Fixes enable checkbox not reversing if the descision was cancelled in CP --- TGControlPanel/InstanceSelector.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/TGControlPanel/InstanceSelector.cs b/TGControlPanel/InstanceSelector.cs index 315868f3cc..238f422f04 100644 --- a/TGControlPanel/InstanceSelector.cs +++ b/TGControlPanel/InstanceSelector.cs @@ -249,14 +249,20 @@ namespace TGControlPanel if (UpdatingEnabledCheckbox) return; var enabling = EnabledCheckBox.Checked; - if (MessageBox.Show(String.Format("Are you sure you want to {0} this instance?", enabling ? "online" : "offline"), "Instance Status Change", MessageBoxButtons.YesNo) != DialogResult.Yes) - return; - string res = null; - var index = InstanceListBox.SelectedIndex; - await WrapServerOp(() => res = masterInterface.GetServiceComponent().SetInstanceEnabled(InstanceData[index].Name, enabling)); - if (res != null) - MessageBox.Show(res); - RefreshInstances(); + try + { + if (MessageBox.Show(String.Format("Are you sure you want to {0} this instance?", enabling ? "online" : "offline"), "Instance Status Change", MessageBoxButtons.YesNo) != DialogResult.Yes) + return; + string res = null; + var index = InstanceListBox.SelectedIndex; + await WrapServerOp(() => res = masterInterface.GetServiceComponent().SetInstanceEnabled(InstanceData[index].Name, enabling)); + if (res != null) + MessageBox.Show(res); + } + finally + { + RefreshInstances(); + } } ///