private void LoadRepositories(ICollection <string> collection) { LocationTree.ItemsSource = new List <IRepoControl>(); LocationList.Clear(); foreach (string url in collection) { string[] parts = url.Split(urlSplitChars, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 0) { return; } RepositoryFolder currentNode = LocationTree; for (int i = 0; i < parts.Length - 1; i++) { currentNode = currentNode.GetOrAddChildFolder(parts[i]); } LocationList.Add(currentNode.AddChildRepository(parts[parts.Length - 1], url, NewItem_Checked)); } LocationList.Sort((c1, c2) => c1.Content.ToString().CompareTo(c2.Content.ToString())); }