PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

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

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