Esempio n. 1
0
        protected MasterDetailsViewModelBase(ViewModelFactoryBase <TDomainClass> viewModelFactory,
                                             CatalogBase <TDomainClass> catalog)
        {
            // Sanity checks, so we don't need null checks elsewhere
            if (viewModelFactory == null)
            {
                throw new ArgumentNullException(nameof(viewModelFactory));
            }
            if (catalog == null)
            {
                throw new ArgumentNullException(nameof(catalog));
            }

            _catalog          = catalog;
            _viewModelFactory = viewModelFactory;

            _masterViewModel       = _viewModelFactory.CreateMasterViewModel();
            _detailsViewModel      = null;
            _itemViewModelSelected = null;

            _stateManager = new ViewControlStateManager();
            _viewState    = ViewControlState.ViewState.Read;

            SetupViewStateCommands();
            SetupViewActionControllers();
        }
Esempio n. 2
0
        public virtual ObservableCollection <ItemViewModelBase <TDomainClass> > CreateItemViewModelCollection(
            DomainModelBase <TDomainClass> domainModel,
            ViewModelFactoryBase <TDomainClass> factory)
        {
            _itemViewModelCollection.Clear();

            foreach (TDomainClass obj in domainModel.All)
            {
                _itemViewModelCollection.Add(factory.CreateItemViewModel(obj));
            }

            return(_itemViewModelCollection);
        }
Esempio n. 3
0
        public virtual ObservableCollection <ItemViewModelBase <TDomainClass> > CreateItemViewModelCollection(
            CatalogBase <TDomainClass> catalog,
            ViewModelFactoryBase <TDomainClass> factory)
        {
            _itemViewModelCollection.Clear();

            foreach (TDomainClass obj in catalog.FilteredAll)
            {
                _itemViewModelCollection.Add(factory.CreateItemViewModel(obj));
            }

            return(_itemViewModelCollection);
        }
        protected MasterDetailsViewModelBase(ViewModelFactoryBase <TDomainClass> viewModelFactory,
                                             DomainModelBase <TDomainClass> domainModel)
        {
            _domainModel      = domainModel;
            _viewModelFactory = viewModelFactory;

            _masterViewModel       = _viewModelFactory.CreateMasterViewModel();
            _detailsViewModel      = null;
            _itemViewModelSelected = null;

            _stateManager = new ViewControlStateManager();
            _viewState    = ViewControlState.ViewState.Read;

            SetupViewStateCommands();
            SetupViewActionControllers();
        }