void AddChildren(TemplateCategory category) { foreach (var childCodon in ChildNodes.OfType <TemplateCategoryCodon> ()) { category.AddCategory(childCodon.ToTemplateCategory()); } }
static TemplateCategory CreateTemplateCategory(XmlElement node) { var category = new TemplateCategory( node.GetAttribute("id"), node.GetAttribute("name"), null); foreach (XmlElement childNode in node.SelectNodes("./Category")) { category.AddCategory(CreateTemplateCategory(childNode)); } return(category); }
public TemplateCategoryViewModel AddTopLevelCategory() { var topLevelCategory = CreateUniqueCategory("top", "Top Level", categories); var secondLevelCategory = new TemplateCategory("second", "Second Level", null); var thirdLevelCategory = new TemplateCategory("third", "Third Level", null); topLevelCategory.AddCategory(secondLevelCategory); secondLevelCategory.AddCategory(thirdLevelCategory); var viewModel = new TemplateCategoryViewModel(null, topLevelCategory); categories.Add(viewModel); return(viewModel); }