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