Exemplo n.º 1
0
        public void SetUpdateDataForType <T>(Func <T, bool> canDoUpdateCallback, Action <T> onInstanceUpdateCallback, Action <T> onInstanceUnregisteredCallback, int updatesInterval = 0)
        {
            Type t = typeof(T);

            UpdateTypeData d = new UpdateTypeData()
            {
                UpdatesInterval                = updatesInterval,
                InstanceCanDoUpdateCallback    = canDoUpdateCallback == null ? (Func <object, bool>)null : (o) => { return(canDoUpdateCallback((T)o)); },
                OnInstanceUpdateCallback       = onInstanceUpdateCallback == null ? (Action <object>)null : (o) => { onInstanceUpdateCallback((T)o); },
                OnInstanceUnregisteredCallback = onInstanceUnregisteredCallback == null ? (Action <object>)null : (o) => { onInstanceUnregisteredCallback((T)o); }
            };

            if (UpdatableDataByType.ContainsKey(t))
            {
                UpdatableDataByType[t] = d;
            }
            else
            {
                UpdatableDataByType.Add(t, d);
            }
        }
Exemplo n.º 2
0
 public bool IsUpdateDataSetForType <T>() => UpdatableDataByType.ContainsKey(typeof(T));