I'm looking for samples / best practices of Event Aggregator implementation.
Anyone help ?
I'm looking for samples / best practices of Event Aggregator implementation.
Anyone help ?
The best sample of an Event Aggregator would probably be the one from Prism. This was designed by the Patterns and Practices team as part of the Composite WPF and Silverlight Guidance.
Good references i found:
http://weblogs.asp.net/rashid/archive/2009/03/05/use-event-aggregator-to-make-your-application-more-extensible.aspx
there's a nice one in the MVVM Light toolkit by Laurent Bugnion. Here's the interface
public interface IMessenger
{
void Register<TMessage>(object recipient, Action<TMessage> action);
void Register<TMessage>(object recipient, bool receiveDerivedMessagesToo, Action<TMessage> action);
void Send<TMessage>(TMessage message);
void Send<TMessage, TTarget>(TMessage message);
void Unregister(object recipient);
void Unregister<TMessage>(object recipient);
void Unregister<TMessage>(object recipient, Action<TMessage> action);
}