void LocalOwnerPresence_PresenceNotificationReceived(object sender, LocalPresentityNotificationEventArgs e) { user.LocalOwnerPresence.PresenceNotificationReceived -= LocalOwnerPresence_PresenceNotificationReceived; foreach (PresenceCategoryWithMetaData category in e.SelfUsageCategories) { if (category.Name.ToLowerInvariant() == "alerts") { alertNotification = category; break; } } waitForAlertNotificationUpdate.Set(); }
/// <summary> /// The event handler for the Category Notification. Notifications come /// in the form of a list of items. We are only interested in state /// publications here, so we will only process those. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LocalOwnerPresence_PresenceNotificationReceived(object sender, LocalPresentityNotificationEventArgs e) { Console.WriteLine("Presence notifications received for target {0}.", this._userEndpoint.OwnerUri); // Notifications contain all the notifications for one user. // Each user will send a list of updated categories. We will choose // the ones we are interested in and process them. // Display to console the value of the Note category. if (e.PersonalNote != null) { Console.WriteLine("Note type {0} with message {1} received.", NoteType.Personal, e.PersonalNote.Message); } // Display to console the value of the Aggregate Presence category. if (e.AggregatedPresenceState != null) { Console.WriteLine("Aggregate State = " + e.AggregatedPresenceState.Availability); } // Display to console the value of the capabilities of the // sample's user endpoint. if (e.ServiceCapabilities != null) { Console.WriteLine("Is IM enabled: ", e.ServiceCapabilities.InstantMessagingEnabled == ServiceCapabilitySupport.Enabled); Console.WriteLine("Is Audio enabled: ", e.ServiceCapabilities.AudioEnabled == ServiceCapabilitySupport.Enabled); Console.WriteLine("Is AppSharing enabled: ", e.ServiceCapabilities.ApplicationSharingEnabled == ServiceCapabilitySupport.Enabled); } // Display to console the value of the ContactCard category. if (e.ContactCard != null) { Console.WriteLine("Title = {0}", e.ContactCard.JobTitle); } }