How to check event aggregator subscriptions?

Topics: Prism v4 - Silverlight 4
Jul 6, 2011 at 7:35 AM


I would please like to know how to check if an event handler has already been subscribed to a particular event so that the same event handler is not subsubscribed more than once?


Jul 6, 2011 at 11:13 AM
Edited Jul 6, 2011 at 11:14 AM


Jul 6, 2011 at 5:34 PM


You might find the Contains method in the EventBase class (from which the CompositePresentationEvent class inherits) useful, as it allows you to determine whether an event contains a certain subscription. The way to determine that is to provide a subscription token, which is an identifier of the subscription. The token is returned when you call the Subscribe method of a CompositePresentationEvent.

You can find more information about this in the CompositePresentationEvent section of the Communication Chapter in the Prism MSDN documentation.

I hope you find this helpful.

Guido Leandro Maliandi