Files
mRemoteNG/mRemoteV1/Tree/PreviouslyOpenedFolderExpander.cs

20 lines
731 B
C#

using System.Linq;
using mRemoteNG.Container;
using mRemoteNG.UI.Controls;
namespace mRemoteNG.Tree
{
public class PreviouslyOpenedFolderExpander : IConnectionTreeDelegate
{
public void Execute(IConnectionTree connectionTree)
{
var rootNode = connectionTree.GetRootConnectionNode();
var containerList = connectionTree.ConnectionTreeModel.GetRecursiveChildList(rootNode)
.OfType<ContainerInfo>();
var previouslyExpandedNodes = containerList.Where(container => container.IsExpanded);
connectionTree.ExpandedObjects = previouslyExpandedNodes;
connectionTree.InvokeRebuildAll(true);
}
}
}