protected MasterDetailsViewModelCRUD(
            IViewModelFactory <TVMO> viewModelFactory,
            PersistableCatalog <T, TVMO, TDTO> catalog,
            List <string> immutableControls,
            List <string> mutableControls)
            : base(viewModelFactory, catalog)
        {
            CRUDControlStateService CRUDcontrolStateService = new CRUDControlStateService();

            // Set all default control behaviors in CRUD-specific state service
            CRUDcontrolStateService.AddImmutableControlsDefaultStates(immutableControls);
            CRUDcontrolStateService.AddMutableControlsDefaultStates(mutableControls);
            CRUDcontrolStateService.AddCRUDInvokerDefaultStates();
            CRUDcontrolStateService.AddStateSelectorDefaultStates();
            CRUDcontrolStateService.AddItemSelectorDefaultStates();

            // Set state services to refer to CRUD-specific services
            ViewStateService    = new CRUDViewStateService();
            ControlStateService = CRUDcontrolStateService;

            // Set command managers to CRUD-specific implementations
            DataCommandManager  = new CRUDCommandManagerViewStateDependent <T, TVMO>(this, catalog, this);
            StateCommandManager = new CRUDViewStateSelectCommandManager(ViewStateService);

            // Set initial View state
            ViewStateService.ViewState = CRUDStates.ReadState;

            // Set mediator to a state-aware implementation
            _mediator = new MasterDetailsViewModelCRUDMediator <T, TVMO, TDTO>(this, catalog, viewModelFactory);
        }
Esempio n. 2
0
 protected virtual void SetupCommandManagers(ICatalog <TVMO> catalog)
 {
     DataCommandManager  = new CRUDCommandManagerViewStateDependent <TVMO>(this, catalog, this);
     StateCommandManager = new CRUDViewStateSelectCommandManager(ViewStateService);
 }