Ejemplo n.º 1
0
        public BookViewModel(Book model)
        {
            Model = model;
            AuthorViewModel = new AuthorViewModel(model.Author);
            if(!AuthorViewModel.PublishedBooks.Contains(this))
                AuthorViewModel.PublishedBooks.Add(this);

            PageViewModels = new ObservableCollection<PageViewModel>();
            foreach (Page page in model.Pages) {
                PageViewModels.Add(new PageViewModel(page));
            }
            PageViewModels.CollectionChanged += new NotifyCollectionChangedEventHandler(PageViewModels_CollectionChanged);

            AddPageCommand = new AddPageCommand(this);
            RemovePageCommand = new RemovePageCommand(this);
        }
 public GameCatalogueViewModel(GameCatalogue model)
 {
     Model = model;
     AuthorViewModel = new AuthorViewModel(model.Author);
     InstantiateGameViewModels(Model.Games);
 }