I sign and unsubscribe prisms using the code below in ClassA. The problem I encountered is after , I unsubscribe, and another completely different class, such as ClassB, with different handler registers for the same event, the ClassA handler is still called. Why is this?
I tried both to cancel the subscription using the token and the delegate of the method used during registration, and to no avail.
SubscriptionToken _subscriptionToken; //register subscription + handler var pevent = GetEventAggregator().GetEvent<PriceSubscriptionEvent>(); _subscriptionToken = pevent.Subscribe(r => { DataHandler(r); return; }, ThreadOption.BackgroundThread, false, null); //Unsubscribe var pevent = GetEventAggregator().GetEvent<PriceSubscriptionEvent>(); pevent.Unsubscribe(_subscriptionToken);
mike01010
source share