public new void Remove(Buddy item) { lock (this) { base.Remove(item); if (!notificationDelayed && BuddyListChanged != null) { BuddyListChanged.Invoke(this, new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Remove, new[] { item })); } } }
private new void Add(Buddy item) { lock (this) { base.Add(item); if (!notificationDelayed && BuddyListChanged != null) { BuddyListChanged.Invoke(this, new BuddyListChangedEventHandlerArgs(BuddyListChangedAction.Add, new[] { item })); } } }
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); }
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())); }
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 })); } } }
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); } } }