Bootstrapper.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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.BehaviorTree;
  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 (BehaviorTreeModule).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", typeof (AutoPopulateExportedViewsBehavior));
  27. return factory;
  28. }
  29. protected override DependencyObject CreateShell()
  30. {
  31. return this.Container.GetExportedValue<Shell>();
  32. }
  33. }
  34. }