Ejemplo n.º 1
0
        public ResourceUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            , IRegionManager regionManager
            , IUnityContainer container
            , IEventAggregator eventAggregator
            // Get the factories that can create the viewmodels
            , ObjectFactory <ResourceListViewModel> resourceViewModel
            , ObjectFactory <ResourceToolbarViewModel> resourceToolbarViewModel
            , IApplicationModel applicationModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
            : base(viewtoToRegionBinder)
        {
            this.ApplicationModel = applicationModel;
            this.Container        = container;
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
                () => this._resourceListViewModel      = resourceViewModel.CreateInstance()
                , () => this._resourceToolbarViewModel = resourceToolbarViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed,
            // use this type of view to visualize it.
            modelVisualizationRegistry.Register <ResourceListViewModel, ResourceListView>();
            modelVisualizationRegistry.Register <ResourceToolbarViewModel, ResourceToolbarView>();
            modelVisualizationRegistry.Register <ResourceEditViewModel, ResourceEditView>();

            container.RegisterType <IResourceAssignService, ResourceAssignmentService>(new ContainerControlledLifetimeManager());
            container.RegisterInstance(container.Resolve <IResourceAssignService>());

            regionManager.RegisterViewWithRegion("ResourceEditRegion", typeof(ResourceEditViewModel));
            // watch for OpenResourceEvents fired by (Link)Button command in ProjectEditViewModel...
            eventAggregator.GetEvent <OpenResourceByIdEvent>().Subscribe(OpenResourceById);
        }
        public ResourceUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            , IRegionManager regionManager
            , IUnityContainer container
            , IEventAggregator eventAggregator
            // Get the factories that can create the viewmodels
            , ObjectFactory<ResourceListViewModel> resourceViewModel
            , ObjectFactory<ResourceToolbarViewModel> resourceToolbarViewModel
            , IApplicationModel applicationModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
           : base(viewtoToRegionBinder)
        {
            this.ApplicationModel = applicationModel;
            this.Container = container;
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
               () => this._resourceListViewModel = resourceViewModel.CreateInstance()
               , () => this._resourceToolbarViewModel = resourceToolbarViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed, 
            // use this type of view to visualize it. 
            modelVisualizationRegistry.Register<ResourceListViewModel, ResourceListView>();
            modelVisualizationRegistry.Register<ResourceToolbarViewModel, ResourceToolbarView>();
            modelVisualizationRegistry.Register<ResourceEditViewModel, ResourceEditView>();

            container.RegisterType<IResourceAssignService, ResourceAssignmentService>(new ContainerControlledLifetimeManager());
            container.RegisterInstance(container.Resolve<IResourceAssignService>());

            regionManager.RegisterViewWithRegion("ResourceEditRegion", typeof(ResourceEditViewModel));
            // watch for OpenResourceEvents fired by (Link)Button command in ProjectEditViewModel...
            eventAggregator.GetEvent<OpenResourceByIdEvent>().Subscribe(OpenResourceById);
        }
Ejemplo n.º 3
0
        public void Initialize()
        {
            // Register visualizations for these view models. This means: whenever a viewmodel is displayed,
            // use this type of view to visualize it.
            modelVisualizationRegistry.Register <EmailToolBarViewModel, EmailToolBar>();
            modelVisualizationRegistry.Register <EmailMainViewModel, EmailMainView>();
            modelVisualizationRegistry.Register <EmailDetailViewModel, EmailDetailView>();
            modelVisualizationRegistry.Register <NewEmailToolBarViewModel, NewEmailToolBar>();
            modelVisualizationRegistry.Register <NewEmailViewModel, NewEmailView>();

            // Add the main email usecase to the application model. This will make sure it displays a button for the usecase in the
            // buttonbar. Clicking the button will activate the use case.
            applicationModel.AddMainUseCase(mainEmailUseCase);

            // Make sure the EmailDetails are always displayed when the EmailDetailRegion is displayed (View Discovery technique)
            regionManager.RegisterViewWithRegion("EmailDetailRegion", typeof(EmailDetailViewModel));
        }
Ejemplo n.º 4
0
        public void Initialize()
        {
            // Add the calendar Main usecase, which will add a button to the buttonbar. Clicking on the button will activate the usecase
            applicationModel.AddMainUseCase(mainCalenderUseCase);

            // Register a visualization for the CalendarMainViewMOdel. Whenever a region shows the CalenderMainViewModel, use the CalendarMainView to visualize it.
            // This is done by the VisualizingRegionManagerRegistrationBehavior which is added to all regions by default.
            modelVisualizationRegistry.Register <CalendarMainViewModel, CalendarMainView>();

            // Whenever the GadgetRegion gets displayed, add a Gadget to it. This displays a different (More direct) way of visualizing ViewModels.
            // The ViewViewModelWrapper wraps both a View and a ViewModel. It is a control, so it can be placed in the visual tree (and thus easily
            // be added to a region)
            regionManager.RegisterViewWithRegion("GatgetRegion", typeof(ViewViewModelWrapper <CalendarSidebarGadget, CalendarSideBarGadgetViewModel>));
        }
Ejemplo n.º 5
0
        public ApplicationModel(IUnityContainer container, IRegionManager regionManager, IEventAggregator eventAggregator, IModelVisualizationRegistry visualizationRegistry)
        {
            this.container      = container;
            this.regionManager  = regionManager;
            this.eventAggregtor = eventAggregator;

            activateUseCaseCommand   = new DelegateCommand <IActiveAwareUseCaseController>(ActivateUseCase);
            deactivateUseCaseCommand = new DelegateCommand <IActiveAwareUseCaseController>(DeactivateUseCase);

            CreateMainUseCasesRegion();

            visualizationRegistry.Register <StatusbarViewModel, StatusbarView>();

            regionManager.RegisterViewWithRegion("StatusbarRegion", typeof(StatusbarViewModel));
        }
Ejemplo n.º 6
0
        public NewResourceUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            // Get the factories that can create the viewmodels
            , ObjectFactory <ResourceEditViewModel> resourceEditViewModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
            : base(viewtoToRegionBinder)
        {
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
                () => this._resourceEditViewModel = resourceEditViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed,
            // use this type of view to visualize it.
            modelVisualizationRegistry.Register <ResourceEditViewModel, ResourceEditView>();
        }
        public NewResourceUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            // Get the factories that can create the viewmodels
            , ObjectFactory<ResourceEditViewModel> resourceEditViewModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
           : base(viewtoToRegionBinder)
        {
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
               () => this._resourceEditViewModel = resourceEditViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed, 
            // use this type of view to visualize it. 
            modelVisualizationRegistry.Register<ResourceEditViewModel, ResourceEditView>();
        }