Bootstrapper.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.Login;
  9. using Modules.WCFClient;
  10. namespace Editor
  11. {
  12. public class Bootstrapper: MefBootstrapper
  13. {
  14. protected override void ConfigureAggregateCatalog()
  15. {
  16. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (Bootstrapper).Assembly));
  17. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (ViewExportAttribute).Assembly));
  18. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (BehaviorTreeModule).Assembly));
  19. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (RobotModule).Assembly));
  20. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (LoginModule).Assembly));
  21. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (WCFClientModule).Assembly));
  22. }
  23. protected override void InitializeShell()
  24. {
  25. base.InitializeShell();
  26. Application.Current.MainWindow = (Shell) this.Shell;
  27. Application.Current.MainWindow.Show();
  28. }
  29. protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
  30. {
  31. IRegionBehaviorFactory factory = base.ConfigureDefaultRegionBehaviors();
  32. factory.AddIfMissing(
  33. "AutoPopulateExportedViewsBehavior",
  34. typeof (AutoPopulateExportedViewsBehavior));
  35. return factory;
  36. }
  37. protected override DependencyObject CreateShell()
  38. {
  39. return this.Container.GetExportedValue<Shell>();
  40. }
  41. }
  42. }