PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/Quickstarts/Modularity/Silverlight/ModularityWithMef/ModuleE/ModuleE.cs

#
C# | 57 lines | 27 code | 4 blank | 26 comment | 2 complexity | 9bf03590d8221f1925e4ebaf7d30ff31 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 System;
  18. using System.ComponentModel.Composition;
  19. using Microsoft.Practices.Prism.MefExtensions.Modularity;
  20. using Microsoft.Practices.Prism.Modularity;
  21. using ModuleTracking;
  22. namespace ModuleE
  23. {
  24. /// <summary>
  25. /// A module for the quickstart.
  26. /// </summary>
  27. [ModuleExport(typeof(ModuleE), InitializationMode = InitializationMode.OnDemand)]
  28. public class ModuleE : IModule
  29. {
  30. private readonly IModuleTracker moduleTracker;
  31. /// <summary>
  32. /// Initializes a new instance of the <see cref="ModuleE"/> class.
  33. /// </summary>
  34. /// <param name="moduleTracker">The module tracker.</param>
  35. [ImportingConstructor]
  36. public ModuleE(IModuleTracker moduleTracker)
  37. {
  38. if (moduleTracker == null)
  39. {
  40. throw new ArgumentNullException("moduleTracker");
  41. }
  42. this.moduleTracker = moduleTracker;
  43. this.moduleTracker.RecordModuleConstructed(WellKnownModuleNames.ModuleE);
  44. }
  45. /// <summary>
  46. /// Notifies the module that it has be initialized.
  47. /// </summary>
  48. public void Initialize()
  49. {
  50. this.moduleTracker.RecordModuleInitialized(WellKnownModuleNames.ModuleE);
  51. }
  52. }
  53. }