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);
        }
Ejemplo n.º 2
0
        protected MasterDetailsViewModelCRUD(
            IViewModelFactory <TVMO> viewModelFactory,
            ICatalog <TVMO> catalog,
            List <string> immutableControls,
            List <string> mutableControls)
            : base(viewModelFactory, catalog)
        {
            CRUDControlStateService CRUDcontrolStateService = new CRUDControlStateService();

            SetupControlBehaviors(CRUDcontrolStateService, immutableControls, mutableControls);

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

            SetupCommandManagers(catalog);
            SetupInitialViewState();

            // Set mediator to a state-aware implementation
            _mediator = new MasterDetailsViewModelCRUDMediator <TVMO>(this, catalog, viewModelFactory);
        }