PageRenderTime 73ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/PrismLibrary/Desktop/Prism.MefExtensions/Modularity/MefModuleManager.Desktop.cs

#
C# | 65 lines | 32 code | 5 blank | 28 comment | 2 complexity | 49960553f72a62ebf42bc3ed5c0cefa6 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.Collections.Generic;
  18. using System.ComponentModel.Composition;
  19. using Microsoft.Practices.Prism.Modularity;
  20. namespace Microsoft.Practices.Prism.MefExtensions.Modularity
  21. {
  22. /// <summary>
  23. /// Component responsible for coordinating the modules' type loading and module initialization process.
  24. /// </summary>
  25. /// <remarks>
  26. /// This allows the MefBootstrapper to provide this class as a default implementation.
  27. /// If another implementation is found, this export will not be used.
  28. /// </remarks>
  29. public partial class MefModuleManager : ModuleManager, IPartImportsSatisfiedNotification
  30. {
  31. // disable the warning that the field is never assigned to, and will always have its default value null
  32. // as it is imported by MEF
  33. #pragma warning disable 0649
  34. [Import(AllowRecomposition = false)]
  35. private MefFileModuleTypeLoader mefFileModuleTypeLoader;
  36. #pragma warning restore 0649
  37. private IEnumerable<IModuleTypeLoader> mefTypeLoaders;
  38. /// <summary>
  39. /// Gets or sets the type loaders used by the module manager.
  40. /// </summary>
  41. public override IEnumerable<IModuleTypeLoader> ModuleTypeLoaders
  42. {
  43. get
  44. {
  45. if (this.mefTypeLoaders == null)
  46. {
  47. this.mefTypeLoaders = new List<IModuleTypeLoader>()
  48. {
  49. this.mefFileModuleTypeLoader
  50. };
  51. }
  52. return this.mefTypeLoaders;
  53. }
  54. set
  55. {
  56. this.mefTypeLoaders = value;
  57. }
  58. }
  59. }
  60. }