/// <summary>
        /// You must call this function if you want to receive an event received with an activity intent.
        /// </summary>
        /// <param name="activity">Your main launcher activity</param>
        public static void OnActivated(Activity activity)
        {
            var toastId = ToastId.FromIntent(activity.Intent);

            if (toastId != null)
            {
                AddPendingEvent(new NotificationEvent(toastId));
            }
        }
Exemple #2
0
 /// <summary>
 /// You must call this function if you want to receive an event received at application startup.
 /// Place call inside App.OnActivated function.
 /// </summary>
 /// <param name="args">Activation args</param>
 public static void OnActivated(ToastNotificationActivatedEventArgs?args)
 {
     if (args != null)
     {
         var collection = HttpUtility.ParseQueryString(args.Argument);
         var tag        = collection[UwpConstants.KTag];
         var group      = collection[UwpConstants.KGroup];
         if (tag != null)
         {
             var tid       = new ToastId(tag, group);
             var @event    = new NotificationEvent(tid);
             var activator = SystemEventSource;
             if (activator == null)
             {
                 AddPendingEvent(@event);
             }
             else
             {
                 activator.SendEvent(@event);
             }
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Show notification and wait for timeout or user action
 /// </summary>
 /// <param name="this">The notification</param>
 /// <param name="toastId">Identifier, that you can use to remove notification from history, store somewhere, etc</param>
 /// <returns>Notification result</returns>
 /// <exception cref="Exceptions.NotificationException"/>
 /// <exception cref="InvalidOperationException">
 /// Can be thrown on android if library can not get
 /// an Android.App.NotificationManager from Application.Context. Unlikely
 /// </exception>
 public static Task <NotificationResult> ShowAsync(this INotification @this, out ToastId toastId)
 => @this.ShowAsync(out toastId, CancellationToken.None);
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationEvent"/> class.
 /// </summary>
 /// <param name="toastId"></param>
 public NotificationEvent(ToastId toastId) => ToastId = toastId;