示例#1
0
 public void SetDirty()
 {
     if (Inited)
     {
         GotDirty?.Invoke(this, this);
     }
 }
示例#2
0
        public TValue this[TKey key]
        {
            get
            {
                lock (map)
                {
                    return(map[key]);
                }
            }
            set
            {
                lock (map)
                {
                    if (!map.ContainsKey(key) || (map[key] == null && value != null) || value is State || map[key].CompareTo(value) != 0)
                    {
                        map[key] = value;

                        if (!Dirty)
                        {
                            Dirty = true;
                            GotDirty?.Invoke(this, EventArgs.Empty);
                        }
                    }
                }
            }
        }
示例#3
0
        public void Add(TKey key, TValue value)
        {
            lock (map)
            {
                map.Add(key, value);

                if (!Dirty)
                {
                    Dirty = true;
                    GotDirty?.Invoke(this, EventArgs.Empty);
                }
            }
        }
示例#4
0
        public void Clear()
        {
            lock (map)
            {
                map.Clear();

                if (!Dirty)
                {
                    Dirty = true;
                    GotDirty?.Invoke(this, EventArgs.Empty);
                }
            }
        }
示例#5
0
        public bool Remove(TKey key)
        {
            lock (map)
            {
                bool removed = map.Remove(key);

                if (removed && !Dirty)
                {
                    Dirty = true;
                    GotDirty?.Invoke(this, EventArgs.Empty);
                }

                return(removed);
            }
        }