public AppleToastNotification(NotificationSourceData source, NotificationAttributeCollection attributes) { NotificationSource = source; if (attributes.ContainsKey(NotificationAttributeID.Title)) { this.Title = attributes[NotificationAttributeID.Title]; } else { this.Title = "Apple Notification"; } if (attributes.ContainsKey(NotificationAttributeID.Message)) { this.Message = attributes[NotificationAttributeID.Message]; } else { this.Message = "New incoming notification"; } if (source.EventFlags.HasFlag(EventFlags.EventFlagPositiveAction)) { if (attributes.ContainsKey(NotificationAttributeID.PositiveActionLabel)) { this.PositiveActionLabel = attributes[NotificationAttributeID.PositiveActionLabel]; } else { this.PositiveActionLabel = "Positive"; } } if (source.EventFlags.HasFlag(EventFlags.EventFlagNegativeAction)) { if (attributes.ContainsKey(NotificationAttributeID.NegativeActionLabel)) { this.NegativeActionLabel = attributes[NotificationAttributeID.NegativeActionLabel]; } else { this.NegativeActionLabel = "Negative"; } } }
public AppleToastNotification(NotificationSourceData source) { this.NotificationSource = source; }
private async void _NotificationSource_NotificationAdded(NotificationSource sender, NotificationSourceData args) { if (sender == _NotificationSource) { if (!Notifications.ContainsKey(args.NotificationUID)) { Notifications.Add(args.NotificationUID, args); } else { Notifications[args.NotificationUID] = args; } // We don't trigger the notification added event as we need to query for // the notification data. // Build the attributes list for the GetNotificationAttributtes command. List <NotificationAttributeID> attributes = new List <NotificationAttributeID>(); attributes.Add(NotificationAttributeID.AppIdentifier); attributes.Add(NotificationAttributeID.Title); attributes.Add(NotificationAttributeID.Message); if (args.EventFlags.HasFlag(EventFlags.EventFlagPositiveAction)) { attributes.Add(NotificationAttributeID.PositiveActionLabel); } if (args.EventFlags.HasFlag(EventFlags.EventFlagNegativeAction)) { attributes.Add(NotificationAttributeID.NegativeActionLabel); } try { GattCommunicationStatus communicationStatus = await ControlPoint.GetNotificationAttributesAsync(args.NotificationUID, attributes); } catch (Exception e) { // Simply log the exception to output console //System.Diagnostics.Debug.WriteLine(ex.Message); } } }
public NotificationEventArgs(NotificationSourceData notificationSource, NotificationAttributeCollection attributes) { this.NotificationSource = notificationSource; this.NotificationAttributes = attributes; }
private void _NotificationSource_NotificationRemoved(NotificationSource sender, NotificationSourceData args) { if (sender == _NotificationSource) { if (Notifications.ContainsKey(args.NotificationUID)) { Notifications.Remove(args.NotificationUID); } this.NotificationRemoved?.Invoke(this, args); } }