private void AddItem(CoordinateSystemListEntry coordinateSystem) { if (Items.Any(i => i.NodeObject is CoordinateSystemListEntry entry && entry.Name == coordinateSystem.Name)) { return; // already added } _children.Add(new CoordinateSystemItem(this) { NodeObject = coordinateSystem }); }
public void Add(string[] categories, CoordinateSystemListEntry coordinateSystem) { if (categories.Count() == 0) { AddItem(coordinateSystem); } else { AddCategory(categories, coordinateSystem); } }
private void AddCategory(string[] categories, CoordinateSystemListEntry coordinateSystem) { var category = Categories.FirstOrDefault(i => (string)i.Name == categories[0]); if (category == null) { category = new CoordinateSystemCategory(this) { NodeObject = categories[0] }; _children.Add(category); } category.Add(categories.Skip(1).ToArray(), coordinateSystem); }