private static XElement WriteCategory(Category category) { var element = new XElement(CategoryName); element.SetAttribute(NameAttr, category.Name); foreach (var documentItem in category.Items) { element.Add(WriteItem(documentItem)); } return element; }
private void OnLoaded(object o) { TreeViewModel = new DocumentItemTreeViewModel(); var testCategory = new Category {Name = "Test"}; testCategory.AddChild(new Link {Name = "Google", Path = "http://google.com"}); TreeViewModel.Categories.Add(testCategory); TreeViewModel.RightClickCommand.Subscribe(_ => AddRootCategory()); }
private static Category ReadCategory(XElement element) { var name = element.AttributeValue(NameAttr, true); var res = new Category {Name = name}; foreach (var childElement in element.Elements()) { res.AddChild(ReadItem(childElement)); } return res; }
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); }