mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
Merge pull request #2924 from mRemoteNG/copilot/fix-first-connection-panel-issue
Fix connection panel visibility issue on first connection
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user