Interacting with MessageBus without ViewModelBase

Apr 30, 2012 at 12:07 PM

Hi, I'm wondering what is the best method for interacting with the MessageBus without inheriting from ViewModelBase<T>.

Currently I just created a MessageBusHelper class that inherits from ViewModelBase<T> so that I can send and receive messages. If this is the best/easiest way that's fine.

Regards, Artur

May 2, 2012 at 2:42 PM

Take a look at the source code for ViewModelBase.  I would suggest copying code from the "Messaging Helpers" region and pasting it into a base class for your non-ViewModel classes.  That should make for a cleaner separation of concerns, and you'll have methods for receiving and sending messages through the MessageBus. Because the MessageBus is leak-proof, there's no need to cal UnRegister.