PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/V4/Quickstarts/View-Switching Navigation/Silverlight/View-Switching Navigation/ViewSwitchingNavigation.Calendar/CalendarModule.cs

#
C# | 44 lines | 19 code | 2 blank | 23 comment | 0 complexity | 2a8d8ec3021c6e2cb1ae1ff75584854d 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.ComponentModel.Composition;
18using Microsoft.Practices.Prism.MefExtensions.Modularity;
19using Microsoft.Practices.Prism.Modularity;
20using Microsoft.Practices.Prism.Regions;
21using ViewSwitchingNavigation.Calendar.Views;
22using ViewSwitchingNavigation.Infrastructure;
23
24namespace ViewSwitchingNavigation.Calendar
25{
26    [ModuleExport(typeof(CalendarModule))]
27    public class CalendarModule : IModule
28    {
29        [Import]
30        public IRegionManager RegionManager;
31
32        public void Initialize()
33        {
34            // todo: 11 - Pre-populating regions with items
35            // Items may be placed in regions prior to navigating to them.  In this case, since we're registering
36            // the type CalendarNavigationItemView, it will be created and added to the region when the MainNavigationRegion 
37            // is loaded.  Even though it is created when the control associated with the region becomes visible,
38            // the view itself won't be visible until it's navigated to. 
39            //
40            // Anything placed in a region in this manner will not be added to the navigation journal.
41            this.RegionManager.RegisterViewWithRegion(RegionNames.MainNavigationRegion, typeof(CalendarNavigationItemView));
42        }
43    }
44}