예제 #1
0
        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);
            }
        }
예제 #2
0
 public void AddChild(ICategory parent, string childName)
 {
     parent.AddChild(new Category(childName));
 }
예제 #3
0
 private void OnAddLinkItem(ICategory toCategory)
 {
     var linkItem = new Link();
     var dialogManager = _container.Resolve<IDialogManager<Link>>();
     if (dialogManager.ShowAddDialog(linkItem) == true)
     {
         toCategory.AddChild(linkItem);
     }
 }
예제 #4
0
 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);
 }