Bootstrapper.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. using Modules.Robot;
  8. namespace Editor
  9. {
  10. public 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 (BehaviorTreeModule).Assembly));
  17. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (RobotModule).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", typeof (AutoPopulateExportedViewsBehavior));
  29. return factory;
  30. }
  31. protected override DependencyObject CreateShell()
  32. {
  33. return this.Container.GetExportedValue<Shell>();
  34. }
  35. }
  36. }