jabber.connection.PubSubNode.ItemAdded C# (CSharp) Method

ItemAdded() public method

Notifies the client that an item has been add to this PubSubNode.
public ItemAdded ( PubSubItem item ) : void
item PubSubItem Item that was added.
return void
        public void ItemAdded(PubSubItem item)
        {
            if (OnItemAdd != null)
                OnItemAdd(this, item);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Adds to the end of the list, replacing any item with the same ID,
        /// or bumping the oldest item if the list is full.
        /// </summary>
        /// <param name="value">PubSubItem to add to the list.</param>
        /// <returns>Index where the PubSubItem was inserted.</returns>
        public override int Add(object value)
        {
            PubSubItem item = value as PubSubItem;

            if (item == null)
            {
                throw new ArgumentException("Must be an XmlElement", "value");
            }
            string id = item.ID;
            int    i;

            if (id == null)
            {
                if (Count == Capacity)
                {
                    RemoveAt(0);
                }
                i = base.Add(value);
                m_node.ItemAdded(item);
                return(i);
            }

            // RemoveId(id);
            if (!m_index.Contains(id) && (Count == Capacity))
            {
                RemoveAt(0);
            }

            i           = base.Add(value);
            m_index[id] = i;
            m_node.ItemAdded(item);
            return(i);
        }