Пример #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 }));
         }
     }
 }
Пример #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 }));
                }
            }
        }
Пример #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);
        }
Пример #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()));
        }
Пример #5
0
        public void Update(Presence presence)
        {
            lock (this)
            {
                var buddy = Get(presence.From);

                if (buddy == null)
                {
                    return;
                }

                buddy.UpdateInfo(presence);

                if (!notificationDelayed && BuddyListChanged != null)
                {
                    BuddyListChanged.Invoke(this,
                                            new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Update, new[] { buddy }));
                }
            }
        }
Пример #6
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);
                }
            }
        }