/// <summary> /// Clears all the values and unsubscribes any existing change notifications. /// </summary> public override void CancelSubscription() { Log.Debug("Canceling collection change subscription"); if (_weakEventListener != null) { _weakEventListener.Detach(); _weakEventListener = null; } Log.Debug("Canceled collection change subscription"); }
/// <summary> /// Clears all the values and unsubscribes any existing change notifications. /// </summary> public override void CancelSubscription() { Log.Debug("Canceling property change subscription"); if (_weakEventListener != null) { _weakEventListener.Detach(); _weakEventListener = null; } _previousPropertyValues.Clear(); Log.Debug("Canceled property change subscription"); }
/// <summary> /// Detaches the event from the event source. /// </summary> public void Detach() { if (weakListener != null) { // do it the GC safe way, because an object could potentially be reclaimed // for garbage collection immediately after the IsAlive property returns true IWeakEventListener target = weakListener.Target as IWeakEventListener; if (target != null) { target.Detach(); } } weakEventSource = null; weakListener = null; }