Bootstrapper.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.ComponentModel.Composition.Hosting;
  2. using System.Windows;
  3. using Microsoft.Practices.Prism.MefExtensions;
  4. using Infrastructure;
  5. using Microsoft.Practices.Prism.Regions;
  6. using BehaviorTree;
  7. namespace Editor
  8. {
  9. public partial 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(BehaviorTreeModule).Assembly));
  16. }
  17. protected override void ConfigureContainer()
  18. {
  19. base.ConfigureContainer();
  20. }
  21. protected override void InitializeShell()
  22. {
  23. base.InitializeShell();
  24. Application.Current.MainWindow = (Shell)this.Shell;
  25. Application.Current.MainWindow.Show();
  26. }
  27. protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
  28. {
  29. var factory = base.ConfigureDefaultRegionBehaviors();
  30. factory.AddIfMissing("AutoPopulateExportedViewsBehavior", typeof(AutoPopulateExportedViewsBehavior));
  31. return factory;
  32. }
  33. protected override DependencyObject CreateShell()
  34. {
  35. return this.Container.GetExportedValue<Shell>();
  36. }
  37. }
  38. }