Esempio n. 1
0
 public void RemoveAction(ObservableEventTypes e, ObservableChange action)
 {
     if (!initialised)
     {
         Init();
     }
     table[e] -= action;
 }
 private void Remove(ObservableEventTypes eventType, ObservableTransform o)
 {
     if (subscriptions.ContainsKey(eventType))
     {
         foreach (var action in subscriptions[eventType])
         {
             o.RemoveAction(eventType, action);
         }
     }
 }
 /// <summary>
 /// Remove an action from all subscribed events on observables.
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public bool RemoveEventAction(ObservableEventTypes eventType, ObservableTransform.ObservableChange action)
 {
     if (subscriptions.ContainsKey(eventType))
     {
         if (subscriptions[eventType].Contains(action))
         {
             foreach (var o in observables.Values)
             {
                 o.RemoveAction(eventType, action);
             }
             return(subscriptions[eventType].Remove(action));
         }
     }
     return(false);
 }
        public bool AddEventAction(ObservableEventTypes eventType, ObservableTransform.ObservableChange action)
        {
            if (!subscriptions.ContainsKey(eventType))
            {
                subscriptions.Add(eventType, new List <ObservableTransform.ObservableChange>());
            }

            if (!subscriptions[eventType].Contains(action))
            {
                subscriptions[eventType].Add(action);
                foreach (var o in observables.Values)
                {
                    o.AddAction(eventType, action);
                }
                return(true);
            }
            return(false);
        }