Bootstrapper.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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(new AssemblyCatalog(typeof (ViewExportAttribute).Assembly));
  18. this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (TreeModule).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("AutoPopulateExportedViewsBehavior",
  33. typeof (AutoPopulateExportedViewsBehavior));
  34. return factory;
  35. }
  36. protected override DependencyObject CreateShell()
  37. {
  38. return this.Container.GetExportedValue<Shell>();
  39. }
  40. }
  41. }