Exemplo n.º 1
0
 protected void OnBeforeItemAddedEvent(object objSender, BeforeItemAddedEventArgs <TObjectType> objArguments)
 {
     if (Initializing == false)
     {
         BeforeItemAddedEventHandler <TObjectType> objHandler = BeforeItemAddedEvent;
         if (objHandler != null)
         {
             objHandler(objSender, objArguments);
         }
     }
 }
Exemplo n.º 2
0
        public virtual void Insert(int intIndex, TObjectType objItem)
        {
            if ((intIndex < 0) || (intIndex > _objItems.Count))
            {
                throw new ArgumentOutOfRangeException("intIndex", "The index is out of range: " + intIndex);
            }

            BeforeItemAddedEventArgs <TObjectType> objArguments = new BeforeItemAddedEventArgs <TObjectType>(objItem);

            OnBeforeItemAddedEvent(this, objArguments);
            if (objArguments.Cancel == false)
            {
                _objItems.Insert(intIndex, objItem);
                OnItemAddedEvent(this, new ItemAddedEventArgs <TObjectType>(objItem));
            }
        }
Exemplo n.º 3
0
 public virtual void Add(TObjectType objItem)
 {
     if (Initializing == true)
     {
         _objItems.Add(objItem);
     }
     else
     {
         BeforeItemAddedEventArgs <TObjectType> objArguments = new BeforeItemAddedEventArgs <TObjectType>(objItem);
         OnBeforeItemAddedEvent(this, objArguments);
         if (objArguments.Cancel == false)
         {
             _objItems.Add(objItem);
             OnItemAddedEvent(this, new ItemAddedEventArgs <TObjectType>(objItem));
         }
     }
 }