Ejemplo n.º 1
0
 /// <summary>
 /// Create the MasterDetails view model object, with
 /// references to a catalog object and a factory object
 /// </summary>
 protected MasterDetailsViewModelBase(
     CatalogBase <TDomainClass> catalog,
     ViewModelFactoryBase <TDomainClass> factory)
 {
     _catalog = catalog;
     _factory = factory;
     _itemViewModelSelected = null;
     _deleteCommand         = new DeleteCommandBase <TDomainClass, MasterDetailsViewModelBase <TDomainClass> >(_catalog, this);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create the MasterDetails view model object, with
 /// references to a model object and a factory object
 /// </summary>
 protected MasterDetailsViewModelBase(
     ViewModelFactoryBase <TDomainClass, TKey> factory,
     ModelBase <TDomainClass, TKey> model)
 {
     _factory               = factory;
     _model                 = model;
     _masterViewModel       = factory.CreateMasterViewModel();
     _deleteCommand         = new RelayCommand(DoDelete, CanDelete);
     _itemViewModelSelected = null;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Performs the deletion of a domain object from the model,
        /// and triggers a re-read of item view models
        /// </summary>
        /// <param name="key">Key for object to delete</param>
        private void Delete(TKey key)
        {
            // Delete from model collection
            _model.Delete(key);

            // Set selection to null
            ItemViewModelSelected = null;

            // Refresh the item list
            OnPropertyChanged(nameof(ItemViewModelCollection));
        }