PageRenderTime 26ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/V2.2/trunk/Quickstarts/UI Composition/ViewInjection/Desktop/UIComposition.Modules.Project/ProjectModule.cs

#
C# | 45 lines | 24 code | 5 blank | 16 comment | 0 complexity | f98b82c79135d34d3cef183e22307060 MD5 | raw file
 1//===================================================================================
 2// Microsoft patterns & practices
 3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
 4//===================================================================================
 5// Copyright (c) Microsoft Corporation.  All rights reserved.
 6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
 7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 9// FITNESS FOR A PARTICULAR PURPOSE.
10//===================================================================================
11// The example companies, organizations, products, domain names,
12// e-mail addresses, logos, people, places, and events depicted
13// herein are fictitious.  No association with any real company,
14// organization, product, domain name, email address, logo, person,
15// places, or events is intended or should be inferred.
16//===================================================================================
17using Microsoft.Practices.Composite.Modularity;
18using Microsoft.Practices.Unity;
19using UIComposition.Modules.Project.Services;
20
21namespace UIComposition.Modules.Project
22{
23    public class ProjectModule : IModule
24    {
25        private readonly IUnityContainer container;
26
27        public ProjectModule(IUnityContainer container)
28        {
29            this.container = container;
30        }
31
32        public void Initialize()
33        {
34            this.RegisterViewsAndServices();
35        }
36
37        protected void RegisterViewsAndServices()
38        {
39            this.container.RegisterType<IProjectService, ProjectService>(new ContainerControlledLifetimeManager());
40
41            this.container.RegisterType<IProjectsListView, ProjectsListView>();
42            this.container.RegisterType<IProjectsListPresenter, ProjectsListPresenter>();
43        }
44    }
45}