Files
mRemoteNG/mRemoteV1/Tree/PreviouslyOpenedFolderExpander.cs
2017-01-14 11:44:09 -07:00

19 lines
684 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);
}
}
}