public void RemoveAction(MemberChangeAction action) { actions.Remove(action); if (actions.Count == 0) { UnsubscribeFromChangeNotificationEvent(); } }
/// <summary> /// Add the specified action to be executed when Notify() is called. /// </summary> /// <param name="action">Action.</param> public void AddAction(MemberChangeAction action) { if (actions.Count == 0) { AddChangeNotificationEventHandler(); } actions.Add(action); }
internal static void RemoveMemberChangeAction(MemberChangeAction sub) { var key = Tuple.Create(sub.Target, sub.Member); MemberActions subs; if (objectSubs.TryGetValue(key, out subs)) { // Debug.WriteLine ("REMOVE CHANGE ACTION " + sub.Target + " " + sub.Member); subs.RemoveAction(sub); } }
internal static MemberChangeAction AddMemberChangeAction(object target, MemberInfo member, Action <int> k) { var key = Tuple.Create(target, member); MemberActions subs; if (!objectSubs.TryGetValue(key, out subs)) { subs = new MemberActions(target, member); objectSubs.Add(key, subs); } // Debug.WriteLine ("ADD CHANGE ACTION " + target + " " + member); var sub = new MemberChangeAction(target, member, k); subs.AddAction(sub); return(sub); }