Example #1
0
 private List <WeakBlock> _Blocks = null;                      //__SILP__
                                                               //__SILP__
 public void AddBlock(WeakBlock block)                         //__SILP__
 {
     if (_Blocks == null)                                      //__SILP__
     {
         _Blocks = new List <WeakBlock>();                     //__SILP__
     }                                                         //__SILP__
     if (!_Blocks.Contains(block))                             //__SILP__
     {
         _Blocks.Add(block);                                   //__SILP__
     }                                                         //__SILP__
 }                                                             //__SILP__
Example #2
0
        }                                                             //__SILP__

        //__SILP__
        public void RemoveBlock(WeakBlock block)                      //__SILP__
        {
            if (_Blocks == null)                                      //__SILP__
            {
                return;                                               //__SILP__
            }                                                         //__SILP__
            int index = _Blocks.IndexOf(block);                       //__SILP__

            if (index >= 0)                                           //__SILP__
            {
                _Blocks.RemoveAt(index);                              //__SILP__
            }                                                         //__SILP__
        }                                                             //__SILP__
Example #3
0
 public bool AddElement(T element)
 {
     if (!Contains(element))
     {
         _Elements.Add(new WeakReference(element));
         WeakBlock block = element as WeakBlock;
         if (block != null)
         {
             block.OnAdded();
         }
         return(true);
     }
     return(false);
 }
Example #4
0
        public bool Remove(T element)
        {
            int index = IndexOf(element);

            if (index >= 0)
            {
                WeakBlock block = element as WeakBlock;
                if (block != null)
                {
                    block.OnRemoved();
                }
                _Elements.RemoveAt(index);
                return(true);
            }
            return(false);
        }