Files
mRemoteNG/mRemoteV1/Tree/ConnectionTreeModel.cs
David Sparer 1e68483deb - Renamed IParent to IHasParent
- Renamed Add, AddRange, Remove, RemoveRange to include the word "Child" to make it more explicit
- Added SetParent and RemoveParent functions
- DeleteNode now works
2016-09-07 09:24:30 -06:00

41 lines
1.1 KiB
C#

using System.Collections.Generic;
using mRemoteNG.Connection;
using mRemoteNG.Container;
using mRemoteNG.Tree.Root;
namespace mRemoteNG.Tree
{
public class ConnectionTreeModel
{
public List<ContainerInfo> RootNodes { get; } = new List<ContainerInfo>();
public void AddRootNode(ContainerInfo rootNode)
{
RootNodes.Add(rootNode);
}
public IEnumerable<ConnectionInfo> GetRecursiveChildList(ContainerInfo container)
{
return container.GetRecursiveChildList();
}
public void RenameNode(ConnectionInfo connectionInfo, string newName)
{
if (newName == null || newName.Length <= 0)
return;
connectionInfo.Name = newName;
if (Settings.Default.SetHostnameLikeDisplayName)
connectionInfo.Hostname = newName;
}
public void DeleteNode(ConnectionInfo connectionInfo)
{
if (connectionInfo is RootNodeInfo)
return;
connectionInfo.Dispose();
}
}
}