Esempio n. 1
0
            public void RemoveAction(MemberChangeAction action)
            {
                actions.Remove(action);

                if (actions.Count == 0)
                {
                    UnsubscribeFromChangeNotificationEvent();
                }
            }
Esempio n. 2
0
            /// <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);
            }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        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);
        }