Example #1
0
        void SendEvent(IEnumerable <INotificationEventObserver> observers, NotificationEvent @event)
        {
            try
            {
                foreach (var i in observers)
                {
                    i.OnNotificationReceived(@event);
                }
            }
#pragma warning disable CS0168 // Variable is declared but never used
            catch (Exception ex)
#pragma warning restore CS0168 // Variable is declared but never used
            {
#if NETSTANDARD1_4 == false
                logger?.LogError(ex, "observer error");
#endif
                throw;
            }
        }
Example #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);
             }
         }
     }
 }
Example #3
0
 public void OnNotificationReceived(NotificationEvent @event)
 => NotificationReceived?.Invoke(systemEventRouter, @event);
Example #4
0
        public void SendEvent(NotificationEvent @event)
        {
            var observers = GetObservers();

            SendEvent(observers, @event);
        }