/// <summary> /// Handles contact notification. /// </summary> /// <param name="sender">The sender of the event. ContactGroupServices.</param> /// <param name="e">The event argument.</param> private void ContactGroupServices_NotificationReceived(object sender, ContactGroupNotificationEventArgs e) { // This handler should be called once at least before subscription operation completes. lock (this.SyncRoot) { if (e.IsFullNotification) { m_contacts.Clear(); } foreach (var contact in e.Contacts) { if (contact.Operation == PublishOperation.Delete || contact.Operation == PublishOperation.Update) { if (m_contacts.ContainsKey(contact.Item.Uri)) { m_contacts.Remove(contact.Item.Uri); } } if (contact.Operation != PublishOperation.Delete) { ContactInformation info = new ContactInformation(contact.Item.Uri); info.Contact = contact.Item; m_contacts.Add(contact.Item.Uri, info); } } } }
void ContactGroupServices_NotificationReceived(object sender, ContactGroupNotificationEventArgs e) { if (e.IsFullNotification) { user.ContactGroupServices.NotificationReceived -= ContactGroupServices_NotificationReceived; userContacts.Clear(); userGroups.Clear(); for (int i = 0; i < e.Contacts.Count; i++) { userContacts.Add(e.Contacts[i].Item); } for (int i = 0; i < e.Groups.Count; i++) { userGroups.Add(e.Groups[i].Item); } waitForContactListUpdate.Set(); } }