Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class IocKernel
- {
- private static StandardKernel _kernel;
- private static int _sendingChainDepth;
- private static FormBase _latestViewModel;
- public static void SendTo<T>() where T: FormBase
- {
- if (_kernel == null)
- return;
- _sendingChainDepth++;
- T newViewModel = _kernel.Get<T>();
- if (_latestViewModel == null)
- _latestViewModel = newViewModel;
- _sendingChainDepth--;
- if (_sendingChainDepth != 0)
- return;
- Messenger.Default.Send(new SetMainViewModel { ViewModel = _latestViewModel });
- _latestViewModel = null;
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement