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 void CanCreateView() { var serviceLocator = new UnityServiceLocatorAdapter(new UnityContainer()); var objectFactory = new ObjectFactory<MockView>(serviceLocator); Assert.IsInstanceOfType(objectFactory.CreateInstance(), typeof(MockView)); Assert.IsInstanceOfType(objectFactory.Value, typeof(MockView)); }
public void CanImplicitlyConvertToType() { var serviceLocator = new UnityServiceLocatorAdapter(new UnityContainer()); var objectFactory = new ObjectFactory<MockView>(serviceLocator); var expected = objectFactory.CreateInstance(); MockView view = objectFactory; Assert.AreEqual(expected, view); }
public CalendarMainUseCase( // Get the ViewToRegionBinder that the baseclass needs IViewToRegionBinder viewtoToRegionBinder, // Get the factory that will create the viewmodel ObjectFactory<CalendarMainViewModel> calendarMainViewFactory): base(viewtoToRegionBinder) { // When the usecase get's activated for the first time AddInitializationMethods( // Create the viewmodel and assign it to this variable () => this.viewModel = calendarMainViewFactory.CreateInstance()); }
public NewEmailUseCase( IViewToRegionBinder viewtoToRegionBinder, ObjectFactory<NewEmailViewModel> newEmailViewFactory, ObjectFactory< NewEmailToolBarViewModel> newEmailToolBarFactory, IExchangeService exchangeService, IRegionManager regionManager) : base (viewtoToRegionBinder) { this.AddInitializationMethods( () => this.newEmailViewModel = newEmailViewFactory.CreateInstance() , () => this.newEmailToolBarViewModel = newEmailToolBarFactory.CreateInstance()); this.exchangeService = exchangeService; this.RegionManager = regionManager; }
public EmailMainUseCase( // Get the ViewToRegionBinder that the baseclass needs IViewToRegionBinder viewtoToRegionBinder // Get the factories that can create the viewmodels , ObjectFactory<EmailMainViewModel> emailViewFactory , ObjectFactory<EmailToolBarViewModel> emailToolBarFactory , IApplicationModel applicationModel) : base(viewtoToRegionBinder) { ApplicationModel = applicationModel; // Just before the view is initialized for the first time this.AddInitializationMethods( // Create the emailViewModel and assign it to this variable () => this.emailViewModel = emailViewFactory.CreateInstance() // Create the toolbarViewModel and assign it to this variable , () => this.emailToolBarViewModel = emailToolBarFactory.CreateInstance()); }
public NewProjectUseCase( // Get the ViewToRegionBinder that the baseclass needs IViewToRegionBinder viewtoToRegionBinder // Get the factories that can create the viewmodels , ObjectFactory<ProjectEditViewModel> projectEditViewModel , IApplicationModel applicationModel , 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._projectEditViewModel = projectEditViewModel.CreateInstance()); // Register visualizations for these view models. This means: whenever a viewmodel is displayed, // use this type of view to visualize it. modelVisualizationRegistry.Register<ProjectEditViewModel, ProjectEditView>(); }
public RolesListUseCase( // Get the ViewToRegionBinder that the baseclass needs IViewToRegionBinder viewtoToRegionBinder , IRegionManager regionManager // Get the factories that can create the viewmodels , ObjectFactory<RolesListViewModel> rolesViewModel , ObjectFactory<RolesToolbarViewModel> rolesToolbarViewModel , IApplicationModel applicationModel) : base(viewtoToRegionBinder) { this._applicationModel = applicationModel; // Just before the view is initialized for the first time this.AddInitializationMethods( // Create the emailViewModel and assign it to this variable () => this._rolesListViewModel = rolesViewModel.CreateInstance() , () => this._rolesToolbarViewModel = rolesToolbarViewModel.CreateInstance()); }