Bootstrapper.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. using Modules.WaiGua;
  9. namespace Editor
  10. {
  11. public class Bootstrapper: MefBootstrapper
  12. {
  13. protected override void ConfigureAggregateCatalog()
  14. {
  15. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (Bootstrapper).Assembly));
  16. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (ViewExportAttribute).Assembly));
  17. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (BehaviorTreeModule).Assembly));
  18. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (RobotModule).Assembly));
  19. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (WaiGuaModule).Assembly));
  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. IRegionBehaviorFactory factory = base.ConfigureDefaultRegionBehaviors();
  30. factory.AddIfMissing(
  31. "AutoPopulateExportedViewsBehavior",
  32. typeof (AutoPopulateExportedViewsBehavior));
  33. return factory;
  34. }
  35. protected override DependencyObject CreateShell()
  36. {
  37. return this.Container.GetExportedValue<Shell>();
  38. }
  39. }
  40. }