Exemplo n.º 1
0
            public void Remove(ChatListSubItem subItem)
            {
                int index = this.IndexOf(subItem);

                if (-1 != index)
                {
                    this.RemoveAt(index);
                }
            }
Exemplo n.º 2
0
 private void EnsureSpace(int elements)
 {
     if (this.m_arrSubItems == null)
     {
         this.m_arrSubItems = new ChatListSubItem[Math.Max(elements, 4)];
     }
     else if ((elements + this.count) > this.m_arrSubItems.Length)
     {
         ChatListSubItem[] array = new ChatListSubItem[Math.Max((int)(this.m_arrSubItems.Length * 2), (int)(elements + this.count))];
         this.m_arrSubItems.CopyTo(array, 0);
         this.m_arrSubItems = array;
     }
 }
Exemplo n.º 3
0
 public void Add(ChatListSubItem subItem)
 {
     if (subItem == null)
     {
         throw new ArgumentNullException("SubItem cannot be null");
     }
     this.EnsureSpace(1);
     if (-1 == this.IndexOf(subItem))
     {
         subItem.OwnerListItem            = this.owner;
         this.m_arrSubItems[this.count++] = subItem;
         if (this.owner.OwnerChatListBox != null)
         {
             this.owner.OwnerChatListBox.Invalidate();
         }
     }
 }
Exemplo n.º 4
0
 public void AddAccordingToStatus(ChatListSubItem subItem)
 {
     if (subItem.Status == ChatListSubItem.UserStatus.OffLine)
     {
         this.Add(subItem);
     }
     else
     {
         int index = 0;
         int count = this.count;
         while (index < count)
         {
             if (subItem.Status <= this.m_arrSubItems[index].Status)
             {
                 this.Insert(index, subItem);
                 return;
             }
             index++;
         }
         this.Add(subItem);
     }
 }
Exemplo n.º 5
0
 public void Insert(int index, ChatListSubItem subItem)
 {
     if ((index < 0) || (index > this.count))
     {
         throw new IndexOutOfRangeException("Index was outside the bounds of the array");
     }
     if (subItem == null)
     {
         throw new ArgumentNullException("SubItem cannot be null");
     }
     this.EnsureSpace(1);
     for (int i = this.count; i > index; i--)
     {
         this.m_arrSubItems[i] = this.m_arrSubItems[i - 1];
     }
     subItem.OwnerListItem     = this.owner;
     this.m_arrSubItems[index] = subItem;
     this.count++;
     if (this.owner.OwnerChatListBox != null)
     {
         this.owner.OwnerChatListBox.Invalidate();
     }
 }
Exemplo n.º 6
0
 public int IndexOf(ChatListSubItem subItem)
 {
     return(Array.IndexOf <ChatListSubItem>(this.m_arrSubItems, subItem));
 }
Exemplo n.º 7
0
 public bool Contains(ChatListSubItem subItem)
 {
     return(this.IndexOf(subItem) != -1);
 }