Subscribe to all events

Topics: Prism v4 - Silverlight 4
Sep 28, 2011 at 2:09 PM

Is there a way to subscribe to all events in MEF?  I've created a state machine that needs to get all events generated.  It wasn't obvious on the event aggregator.

Sep 28, 2011 at 3:56 PM


It would be helpful if you could provide us with more details about your scenario, since we're not sure of what you're referring to when you mention "subscribe to all events".

If you refer to the events you publish with the event aggregator, you could modify the Prism Library to include custom code in the EventAggregator class, and subscribe to all the events in the events dictionary inside that class (the instances of the events are stored as the values of a <Type,EventBase> dictionary). If you don't wish to modify the Prism Library to achieve this, you can create a custom implementation of the IEventAggregator class which contains this logic by default.

I hope you find this helpful.

Guido Leandro Maliandi