Guest User

Untitled

a guest
Jan 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public class Bootstrapper : BootstrapperBase
  2. {
  3. private readonly ElementHost _host;
  4. // 以 ViewModel First Approach
  5. private ShellViewModel ShellVM;
  6.  
  7. public Bootstrapper(ElementHost host) : base(false)
  8. {
  9. this._host = host;
  10. this.Initialize();
  11. }
  12.  
  13. protected override void StartRuntime()
  14. {
  15. base.StartRuntime();
  16.  
  17. ShellVM = IoC.Get <ShellViewModel>();
  18. var view = ViewLocator.LocateForModel(ShellVM, null, null);
  19.  
  20.  
  21. ViewModelBinder.Bind(ShellVM, view, null);
  22.  
  23. var activator = ShellVM as IActivate;
  24.  
  25. if (activator != null)
  26. activator.Activate();
  27.  
  28. _host.Child = view;
  29. }
  30.  
  31. protected override IEnumerable<System.Reflection.Assembly> SelectAssemblies()
  32. {
  33.  
  34. return base.SelectAssemblies().Where(x => !AssemblySource.Instance.Contains(x));
  35. }
  36.  
  37. public void Start()
  38. {
  39. ShellVM.Start();
  40. }
  41.  
  42. public void Stop()
  43. {
  44. ShellVM.Stop();
  45. }
  46. }
Add Comment
Please, Sign In to add comment