weakeventmanager

Why WeakEventManager does not fire an event when the sender is not the nominal?

匆匆过客 提交于 2019-12-10 16:58:53
问题 I don't like off-the-standard pattern, but I was making a quick test on my app, and I bumped against this strange behavior. Consider a normal class exposing an event, here the very common PropertyChanged, but I think could be any other. The subscriber chooses to subscribe the event via the WeakEventManager helper. Now, the "odd" thing is the actual sender reference: as long the instance is the same as was used on the subscription, everything goes fine. However, when you use another object, no

Example implementation of weak events using .NET's WeakEventManager

流过昼夜 提交于 2019-12-03 08:22:07
问题 Is there an example implementation of weak events using .NET's WeakEventManager? I'm trying to implement it by following the "Notes to Inheritors" in the documentation, but it is vague. For example, I can't figure out how to call ProtectedAddListener from my static AddListener function in my custom manager. 回答1: I figured it out on my own following the guidelines in the "Notes for Inheritors" section of the WeakEventManager documentation. Here's a basic implementation of WeakEventManager .

Example implementation of weak events using .NET's WeakEventManager

橙三吉。 提交于 2019-12-02 22:06:26
Is there an example implementation of weak events using .NET's WeakEventManager ? I'm trying to implement it by following the "Notes to Inheritors" in the documentation, but it is vague. For example, I can't figure out how to call ProtectedAddListener from my static AddListener function in my custom manager. M. Dudley I figured it out on my own following the guidelines in the "Notes for Inheritors" section of the WeakEventManager documentation. Here's a basic implementation of WeakEventManager . The class sourcing the event is named PropertyValue and the event is named Changed . public class