diff --git a/mRemoteV1/Connection/ConnectionInitiator.cs b/mRemoteV1/Connection/ConnectionInitiator.cs index 635ccaed5..4d3c4b162 100644 --- a/mRemoteV1/Connection/ConnectionInitiator.cs +++ b/mRemoteV1/Connection/ConnectionInitiator.cs @@ -162,34 +162,15 @@ namespace mRemoteNG.Connection private static string SetConnectionPanel(ConnectionInfo connectionInfo, ConnectionInfo.Force force) { - string connectionPanel; - if (connectionInfo.Panel == "" || force.HasFlag(ConnectionInfo.Force.OverridePanel) || - Settings.Default.AlwaysShowPanelSelectionDlg) - { - var frmPnl = new FrmChoosePanel(); - if (frmPnl.ShowDialog() == DialogResult.OK) - { - connectionPanel = frmPnl.Panel; - } - else - { - return null; - } - } - else - { - //Return the current panel if exist, if not return default panel - if (TabHelper.Instance.CurrentPanel != null) - { - connectionPanel = TabHelper.Instance.CurrentPanel.TabText; - } - else - { - connectionPanel = connectionInfo.Panel; - } - } + if (connectionInfo.Panel != "" && + !force.HasFlag(ConnectionInfo.Force.OverridePanel) && + !Settings.Default.AlwaysShowPanelSelectionDlg) + return connectionInfo.Panel; - return connectionPanel; + var frmPnl = new FrmChoosePanel(); + return frmPnl.ShowDialog() == DialogResult.OK + ? frmPnl.Panel + : null; } private Form SetConnectionForm(Form conForm, string connectionPanel)