public void RefreshChildren() { _categories.Clear(); foreach (var category in TagManager.Instance.Categories) { _categories.Add(TagCategoryViewModel.CreateForCategory(category, _contentController, this)); } if (TagManager.Instance.UncategorizedTags.Any()) { _categories.Add(TagCategoryViewModel.CreateForUncategorized(_contentController, this)); } Children = new ReadOnlyCollection <TagCategoryViewModel>(_categories); }
public static TagCategoryViewModel CreateForUncategorized(IContentController contentController, ITagRearranger tagRearranger) { var viewModel = new TagCategoryViewModel("Uncategorized") { _tagRearranger = tagRearranger }; foreach (var tag in TagManager.Instance.UncategorizedTags) { viewModel._tags.Add(new TaggedViewModel(tag, contentController, tagRearranger)); } viewModel.Children = new ReadOnlyCollection <TaggedViewModel>(viewModel._tags); return(viewModel); }