PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/V2/trunk/RI/Desktop/StockTraderRI.Modules.Market/MarketModule.cs

#
C# | 57 lines | 34 code | 7 blank | 16 comment | 0 complexity | 19c641008ec7c3c3d14b15a06fa6357c 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. //===================================================================================
  17. using Microsoft.Practices.Composite.Modularity;
  18. using Microsoft.Practices.Composite.Regions;
  19. using Microsoft.Practices.Unity;
  20. using StockTraderRI.Infrastructure;
  21. using StockTraderRI.Infrastructure.Interfaces;
  22. using StockTraderRI.Modules.Market.Services;
  23. using StockTraderRI.Modules.Market.TrendLine;
  24. namespace StockTraderRI.Modules.Market
  25. {
  26. public class MarketModule : IModule
  27. {
  28. private readonly IUnityContainer container;
  29. private readonly IRegionManager regionManager;
  30. public MarketModule(IUnityContainer container, IRegionManager regionManager)
  31. {
  32. this.container = container;
  33. this.regionManager = regionManager;
  34. }
  35. #region IModule Members
  36. public void Initialize()
  37. {
  38. RegisterViewsAndServices();
  39. this.regionManager.RegisterViewWithRegion(RegionNames.ResearchRegion, () => this.container.Resolve<ITrendLinePresentationModel>().View);
  40. }
  41. protected void RegisterViewsAndServices()
  42. {
  43. container.RegisterType<IMarketHistoryService, MarketHistoryService>(new ContainerControlledLifetimeManager());
  44. container.RegisterType<IMarketFeedService, MarketFeedService>(new ContainerControlledLifetimeManager());
  45. container.RegisterType<ITrendLineView, TrendLineView>();
  46. container.RegisterType<ITrendLinePresentationModel, TrendLinePresentationModel>();
  47. }
  48. #endregion
  49. }
  50. }