private void OnCurrentProjectChanged(IManuscriptProject obj) { if (obj != null) { CurrentProject = new ManuscriptProjectViewModel(obj, _regionManager, _manuscriptService, _windowsDialogService); Title = CurrentProject.Name; var navigationParams = new NavigationParameters { { "currentCategories", CurrentProject.Categories } }; _regionManager.RequestNavigate("ProjectStructureRegion", "ProjectStructure", navigationParams); } }
public ManuscriptProjectViewModel(IManuscriptProject manuscriptProject, IRegionManager regionManager, IManuscriptService manuscriptService, IWindowsDialogService windowsDialogService) { _regionManager = regionManager; _manuscriptService = manuscriptService; _windowsDialogService = windowsDialogService; Name = manuscriptProject.Name; Categories = ToObservableCollection(manuscriptProject.Categories); Id = manuscriptProject.Id; foreach (var ctg in manuscriptProject.Categories) { ctg.CollectionChanged += OnProjectCategoryItemsChanged; foreach (var item in ctg.Items) { item.CollectionChanged += OnProjectItemReferencesChanged; } } }