Bootstrapper.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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("AutoPopulateExportedViewsBehavior", typeof (AutoPopulateExportedViewsBehavior));
  31. return factory;
  32. }
  33. protected override DependencyObject CreateShell()
  34. {
  35. return this.Container.GetExportedValue<Shell>();
  36. }
  37. }
  38. }