internal ServerTree(StoredServerGroup rootGroup, List <ApplicationEntity> directoryServers) { LocalServer = new ServerTreeLocalServer(); //Create a copy because we will modify it. directoryServers = directoryServers == null ? new List <ApplicationEntity>() : new List <ApplicationEntity>(directoryServers); if (rootGroup == null) { InitializeRootGroup(); } else { //ToServerTreeGroup eliminates the items from the passed in list of //servers as the references are found in the tree. RootServerGroup = rootGroup.ToServerTreeGroup(directoryServers); } //rootGroup.ToServerTreeGroup above deletes the entries from the list of servers, //so if there are any left, that means there was no match in the tree. So, //we will just add those servers to the root. foreach (ApplicationEntity server in directoryServers) { RootServerGroup.Servers.Add(new ServerTreeDicomServer(server)); } InitializePaths(); CurrentNode = LocalServer; }
public static StoredServerGroup ToStoredServerGroup(this IServerTreeGroup serverTreeGroup) { var storedServerGroup = new StoredServerGroup(serverTreeGroup.Name); foreach (var childGroup in serverTreeGroup.ChildGroups) { storedServerGroup.ChildGroups.Add(childGroup.ToStoredServerGroup()); } foreach (var childServer in serverTreeGroup.Servers) { storedServerGroup.DirectoryServerReferences.Add(new DirectoryServerReference { Name = childServer.Name }); } return(storedServerGroup); }
internal static ServerTreeGroup ToServerTreeGroup(this StoredServerGroup storedServerGroup, List <ApplicationEntity> servers) { var serverTreeGroup = new ServerTreeGroup(storedServerGroup.Name); foreach (var childGroup in storedServerGroup.ChildGroups) { serverTreeGroup.ChildGroups.Add(childGroup.ToServerTreeGroup(servers)); } foreach (var directoryServerReference in storedServerGroup.DirectoryServerReferences) { var reference = directoryServerReference; var foundServerIndex = servers.FindIndex(d => d.Name == reference.Name); if (foundServerIndex >= 0) { var server = (IApplicationEntity)servers[foundServerIndex]; servers.RemoveAt(foundServerIndex); serverTreeGroup.Servers.Add(new ServerTreeDicomServer(server)); } } return(serverTreeGroup); }
internal void UpdateSharedServers(StoredServerGroup storedServerGroup) { this.SetSharedPropertyValue("SharedServers", storedServerGroup); }