コード例 #1
0
ファイル: XmlPersister.cs プロジェクト: rvahitov/link-manager
 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;
 }
コード例 #2
0
 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());
 }
コード例 #3
0
ファイル: XmlPersister.cs プロジェクト: rvahitov/link-manager
 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;
 }
コード例 #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);
 }