I'm making a timeregistration project in Silverlight. I 开发者_如何学Gohave 2 kinds of rights, an admin and a user. I need to send the Logged in user object from one viewmodel to another.
Has anybody any idea how you can do this? Or if there is any alternative?
Help is really needed =)
Thx
You could create a Singleton class (or normal class registered as "singleton like" using your choosen DI container) and use that to store context.
You can use MVVM light messenger
In first view model:
Messenger.Default.Send<MessageWithUserObject>(new MessageWithUserObject(userObject));
In the second:
Messenger.Default.Register<MessageWithUserObject>(this, msg=>{//some action});
精彩评论