Bootstrapper.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.BehaviorTreeModule;
  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(new AssemblyCatalog(typeof (ViewExportAttribute).Assembly));
  15. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (TreeModule).Assembly));
  16. }
  17. protected override void InitializeShell()
  18. {
  19. base.InitializeShell();
  20. Application.Current.MainWindow = (Shell) this.Shell;
  21. Application.Current.MainWindow.Show();
  22. }
  23. protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
  24. {
  25. IRegionBehaviorFactory factory = base.ConfigureDefaultRegionBehaviors();
  26. factory.AddIfMissing("AutoPopulateExportedViewsBehavior",
  27. typeof (AutoPopulateExportedViewsBehavior));
  28. return factory;
  29. }
  30. protected override DependencyObject CreateShell()
  31. {
  32. return this.Container.GetExportedValue<Shell>();
  33. }
  34. }
  35. }