private void AddTreeLeaves(ICategory[] getAllCategories, List <ICategory> flatTree, ICategory category) { var children = getAllCategories.Where(x => x.Parent?.Id == category.Id); foreach (var child in children) { category.AddChild(child); flatTree.Add(child); AddTreeLeaves(getAllCategories, flatTree, child); } }
public void AddChild(ICategory parent, string childName) { parent.AddChild(new Category(childName)); }
private void OnAddLinkItem(ICategory toCategory) { var linkItem = new Link(); var dialogManager = _container.Resolve<IDialogManager<Link>>(); if (dialogManager.ShowAddDialog(linkItem) == true) { toCategory.AddChild(linkItem); } }
private void OnAddCategoryItem(ICategory toCategory) { var category = new Category(); var dialogManager = _container.Resolve<IDialogManager<Category>>(); if (dialogManager.ShowAddDialog(category) != true) return; if (toCategory != null) toCategory.AddChild(category); else _treeViewModel.Categories.Add(category); }