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);
        }
Example #2
0
 protected virtual void SetupControlBehaviors(
     CRUDControlStateService stateService,
     List <string> immutableControls, List <string> mutableControls)
 {
     stateService.AddImmutableControlsDefaultStates(immutableControls);
     stateService.AddMutableControlsDefaultStates(mutableControls);
     stateService.AddCRUDInvokerDefaultStates();
     stateService.AddStateSelectorDefaultStates();
     stateService.AddItemSelectorDefaultStates();
 }