Bootstrapper.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.ComponentModel.Composition.Hosting;
  2. using System.Windows;
  3. using Infrastructure;
  4. using Login;
  5. using Microsoft.Practices.Prism.MefExtensions;
  6. using Microsoft.Practices.Prism.Regions;
  7. using Robot;
  8. using Tree;
  9. using 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(
  18. new AssemblyCatalog(
  19. typeof (ViewExportAttribute).Assembly));
  20. this.AggregateCatalog.Catalogs.Add(
  21. new AssemblyCatalog(
  22. typeof (BehaviorTreeModule).Assembly));
  23. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (RobotModule).Assembly));
  24. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (LoginModule).Assembly));
  25. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (WCFClientModule).Assembly));
  26. }
  27. protected override void InitializeShell()
  28. {
  29. base.InitializeShell();
  30. Application.Current.MainWindow = (Shell) this.Shell;
  31. Application.Current.MainWindow.Show();
  32. }
  33. protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
  34. {
  35. IRegionBehaviorFactory factory = base.ConfigureDefaultRegionBehaviors();
  36. factory.AddIfMissing("AutoPopulateExportedViewsBehavior",
  37. typeof (AutoPopulateExportedViewsBehavior));
  38. return factory;
  39. }
  40. protected override DependencyObject CreateShell()
  41. {
  42. return this.Container.GetExportedValue<Shell>();
  43. }
  44. }
  45. }