Exemple #1
0
 public new void Remove(Buddy item)
 {
     lock (this)
     {
         base.Remove(item);
         if (!notificationDelayed && BuddyListChanged != null)
         {
             BuddyListChanged.Invoke(this,
                                     new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Remove, new[] { item }));
         }
     }
 }
Exemple #2
0
        private new void Add(Buddy item)
        {
            lock (this)
            {
                base.Add(item);

                if (!notificationDelayed && BuddyListChanged != null)
                {
                    BuddyListChanged.Invoke(this,
                                            new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Add, new[] { item }));
                }
            }
        }
Exemple #3
0
        public void UpdateRange(IList <Presence> updateBuddies)
        {
            DelayNotification(true);

            foreach (var presence in updateBuddies)
            {
                Update(presence);
            }

            BuddyListChanged.Invoke(this,
                                    new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Update, updateBuddies.Select(p => Get(p.From)).ToList()));
            DelayNotification(false);
        }
Exemple #4
0
        public void AddRange(IEnumerable <Buddy> items)
        {
            DelayNotification(true);

            var buddies = items.Distinct(BuddyComparer.Instance).ToList();

            foreach (var buddy in buddies)
            {
                Add(buddy);
            }

            DelayNotification(false);

            BuddyListChanged.Invoke(this,
                                    new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Add, buddies.ToList()));
        }
Exemple #5
0
        public void Remove(Presence presence)
        {
            lock (this)
            {
                var buddy = Get(presence);

                if (buddy == null)
                {
                    return;
                }

                buddy.RemovePresence(presence);

                if (buddy.IsOnline)
                {
                    BuddyListChanged.Invoke(this,
                                            new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Update, new[] { buddy }));
                }
                else
                {
                    Remove(buddy);
                }
            }
        }