Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public static class IocKernel
  2. {
  3. private static StandardKernel _kernel;
  4. private static int _sendingChainDepth;
  5. private static FormBase _latestViewModel;
  6.  
  7. public static void SendTo<T>() where T: FormBase
  8. {
  9. if (_kernel == null)
  10. return;
  11. _sendingChainDepth++;
  12. T newViewModel = _kernel.Get<T>();
  13. if (_latestViewModel == null)
  14. _latestViewModel = newViewModel;
  15. _sendingChainDepth--;
  16. if (_sendingChainDepth != 0)
  17. return;
  18. Messenger.Default.Send(new SetMainViewModel { ViewModel = _latestViewModel });
  19. _latestViewModel = null;
  20. }
  21. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement