From 40682bc84233045e23edfe28233d7c8ae24f100e Mon Sep 17 00:00:00 2001 From: Sean Kaim Date: Wed, 9 Jan 2019 22:46:59 -0500 Subject: [PATCH] create empty panel on startup not working Reference #1261 --- mRemoteV1/UI/Forms/frmMain.cs | 22 +++++++++------------- mRemoteV1/UI/Panels/PanelAdder.cs | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs index 96332c2b5..45460e1c0 100644 --- a/mRemoteV1/UI/Forms/frmMain.cs +++ b/mRemoteV1/UI/Forms/frmMain.cs @@ -26,6 +26,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; +using mRemoteNG.UI.Panels; using WeifenLuo.WinFormsUI.Docking; // ReSharper disable MemberCanBePrivate.Global @@ -180,23 +181,18 @@ namespace mRemoteNG.UI.Forms Opacity = 1; //Fix MagicRemove , revision on panel strategy for mdi - //Fix MagicRemove, this is a setting pnlDock.ShowDocumentIcon = true; - //Fix missing general panel at the first run - /* if (Settings.Default.CreateEmptyPanelOnStartUp) - { - var panelName = !string.IsNullOrEmpty(Settings.Default.StartUpPanelName) - ? Settings.Default.StartUpPanelName - : Language.strNewPanel; + FrmSplashScreen.getInstance().Close(); - var panelAdder = new PanelAdder(); - if (!panelAdder.DoesPanelExist(panelName)) - panelAdder.AddPanel(panelName); - }*/ + if (!Settings.Default.CreateEmptyPanelOnStartUp) return; + var panelName = !string.IsNullOrEmpty(Settings.Default.StartUpPanelName) + ? Settings.Default.StartUpPanelName + : Language.strNewPanel; - var frmSplashScreen = FrmSplashScreen.getInstance(); - frmSplashScreen.Close(); + var panelAdder = new PanelAdder(); + if (!panelAdder.DoesPanelExist(panelName)) + panelAdder.AddPanel(panelName); } private void ApplyLanguage() diff --git a/mRemoteV1/UI/Panels/PanelAdder.cs b/mRemoteV1/UI/Panels/PanelAdder.cs index 4c5e41a51..795babf3e 100644 --- a/mRemoteV1/UI/Panels/PanelAdder.cs +++ b/mRemoteV1/UI/Panels/PanelAdder.cs @@ -13,7 +13,7 @@ namespace mRemoteNG.UI.Panels { public class PanelAdder { - public Form AddPanel(string title = "") + public ConnectionWindow AddPanel(string title = "") { try { @@ -44,12 +44,12 @@ namespace mRemoteNG.UI.Panels private static void PrepareTabSupport(ConnectionWindow connectionForm) { - Runtime.WindowList.Add(connectionForm); + Runtime.WindowList.Add(connectionForm); } private static void SetConnectionWindowTitle(string title, ConnectionWindow connectionForm) { - if (title == "") + if (string.IsNullOrEmpty(title)) title = Language.strNewPanel; connectionForm.SetFormText(title.Replace("&", "&&")); }