PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/Quickstarts/EventAggregation/Desktop/ModuleB/ModuleB.cs

#
C# | 55 lines | 31 code | 8 blank | 16 comment | 0 complexity | 33a1aa5c9157a2dfa06b2144898aec3c 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.Prism.Modularity;
  18. using Microsoft.Practices.Prism.Regions;
  19. using Microsoft.Practices.Unity;
  20. namespace ModuleB
  21. {
  22. public class ModuleB : IModule
  23. {
  24. public ModuleB(IUnityContainer container, IRegionManager regionManager)
  25. {
  26. Container = container;
  27. RegionManager = regionManager;
  28. RegisterViewsAndServices();
  29. }
  30. private void RegisterViewsAndServices()
  31. {
  32. this.Container.RegisterType<IActivityView, ActivityView>();
  33. }
  34. public void Initialize()
  35. {
  36. ActivityView activityView1 = Container.Resolve<ActivityView>();
  37. ActivityView activityView2 = Container.Resolve<ActivityView>();
  38. activityView1.SetCustomerId("Customer1");
  39. activityView2.SetCustomerId("Customer2");
  40. IRegion rightRegion = RegionManager.Regions["RightRegion"];
  41. rightRegion.Add(activityView1);
  42. rightRegion.Add(activityView2);
  43. }
  44. public IUnityContainer Container { get; private set; }
  45. public IRegionManager RegionManager { get; private set; }
  46. }
  47. }