Bootstrapper.cs 1.4 KB

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