From 8a74809ea47f7501795c2c34f12880680e13ee29 Mon Sep 17 00:00:00 2001 From: David Sparer Date: Tue, 6 Sep 2016 18:05:46 -0600 Subject: [PATCH] Fixed opening previous connections to work with the tree list view --- mRemoteV1/UI/Window/ConnectionTreeWindow.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs index ee0bd49e1..907692738 100644 --- a/mRemoteV1/UI/Window/ConnectionTreeWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionTreeWindow.cs @@ -96,7 +96,8 @@ namespace mRemoteNG.UI.Window olvConnections.Roots = ConnectionTreeModel.RootNodes; ExpandPreviouslyOpenedFolders(); ExpandRootConnectionNode(); - } + OpenConnectionsFromLastSession(); + } private void ExpandRootConnectionNode() { @@ -189,14 +190,14 @@ namespace mRemoteNG.UI.Window olvConnections.RebuildAll(true); } - //TODO Fix for TreeListView public void OpenConnectionsFromLastSession() { if (!Settings.Default.OpenConsFromLastSession || Settings.Default.NoReconnect) return; - foreach (ConnectionInfo conI in Runtime.ConnectionList) + var connectionInfoList = GetRootConnectionNode().GetRecursiveChildList().Where(node => !(node is ContainerInfo)); + var previouslyOpenedConnections = connectionInfoList.Where(item => item.PleaseConnect); + foreach (var connectionInfo in previouslyOpenedConnections) { - if (conI.PleaseConnect) - Runtime.OpenConnection(conI); + Runtime.OpenConnection(connectionInfo); } }