Guest User

Untitled

a guest
Feb 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. public class SCBootstrapper:BootstrapperBase
  2. {
  3. private readonly SimpleContainer _Container = new SimpleContainer();
  4. public SCBootstrapper()
  5. {
  6. Initialize();
  7. }
  8.  
  9. protected override void Configure()
  10. {
  11. _Container.Singleton<IWindowManager, WindowManager>();
  12. _Container.Singleton<IEventAggregator, EventAggregator>();
  13. _Container.PerRequest<IShell, ShellViewModel>();
  14. }
  15. protected override object GetInstance(Type service, string key)
  16. {
  17. var instance = _Container.GetInstance(service, key);
  18. if (instance != null)
  19. return instance;
  20. throw new InvalidOperationException("Could not locate any instances.");
  21. }
  22.  
  23. protected override IEnumerable<object> GetAllInstances(Type service)
  24. {
  25. return _Container.GetAllInstances(service);
  26. }
  27.  
  28. protected override void BuildUp(object instance)
  29. {
  30. _Container.BuildUp(instance);
  31. }
  32. protected override void OnStartup(object sender, StartupEventArgs e)
  33. {
  34. DisplayRootViewFor<IShell>();
  35. }
  36. }
Add Comment
Please, Sign In to add comment