Bootstrapper.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.ComponentModel.Composition.Hosting;
  2. using System.Windows;
  3. using Infrastructure;
  4. using Microsoft.Practices.Prism.MefExtensions;
  5. using Microsoft.Practices.Prism.Regions;
  6. using Modules.Tree;
  7. namespace Editor
  8. {
  9. public class Bootstrapper: MefBootstrapper
  10. {
  11. protected override void ConfigureAggregateCatalog()
  12. {
  13. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (Bootstrapper).Assembly));
  14. this.AggregateCatalog.Catalogs.Add(
  15. new AssemblyCatalog(
  16. typeof (ViewExportAttribute).Assembly));
  17. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (TreeModule).Assembly));
  18. }
  19. protected override void InitializeShell()
  20. {
  21. base.InitializeShell();
  22. Application.Current.MainWindow = (Shell) this.Shell;
  23. Application.Current.MainWindow.Show();
  24. }
  25. protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
  26. {
  27. IRegionBehaviorFactory factory = base.ConfigureDefaultRegionBehaviors();
  28. factory.AddIfMissing("AutoPopulateExportedViewsBehavior",
  29. typeof (AutoPopulateExportedViewsBehavior));
  30. return factory;
  31. }
  32. protected override DependencyObject CreateShell()
  33. {
  34. return this.Container.GetExportedValue<Shell>();
  35. }
  36. }
  37. }