Fix panel visibility issue when opening first connection

Co-authored-by: Kvarkas <3611964+Kvarkas@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-10-16 20:40:36 +00:00
parent 531e117731
commit 4125344254
3 changed files with 13 additions and 3 deletions

View File

@@ -320,7 +320,8 @@ namespace mRemoteNG.Connection
ConnectionWindow connectionForm = conForm ?? Runtime.WindowList.FromString(connectionPanel) as ConnectionWindow;
if (connectionForm == null)
connectionForm = _panelAdder.AddPanel(connectionPanel);
// Don't show the panel immediately - it will be shown when first tab is added
connectionForm = _panelAdder.AddPanel(connectionPanel, showImmediately: false);
else
connectionForm.Show(FrmMain.Default.pnlDock);

View File

@@ -15,14 +15,17 @@ namespace mRemoteNG.UI.Panels
[SupportedOSPlatform("windows")]
public class PanelAdder
{
public ConnectionWindow AddPanel(string title = "")
public ConnectionWindow AddPanel(string title = "", bool showImmediately = true)
{
try
{
ConnectionWindow connectionForm = new(new DockContent());
BuildConnectionWindowContextMenu(connectionForm);
SetConnectionWindowTitle(title, connectionForm);
ShowConnectionWindow(connectionForm);
// Only show immediately if requested (for user-created empty panels)
// When opening connections, we defer showing until first tab is added
if (showImmediately)
ShowConnectionWindow(connectionForm);
PrepareTabSupport(connectionForm);
return connectionForm;
}

View File

@@ -143,6 +143,12 @@ namespace mRemoteNG.UI.Window
// TODO: See if we can make this work with DPS...
//TabController.HideTabsMode = TabControl.HideTabsModes.HideAlways;
// Ensure the ConnectionWindow is visible before adding the tab
// This prevents visibility issues when the window was created but not yet shown
if (!Visible)
{
Show(FrmMain.Default.pnlDock, DockState.Document);
}
//Show the tab
conTab.Show(connDock, DockState.Document);