Contains the definition of the toast notification that will display at the scheduled time.
PlatformVersion supported AndroidAndroid 4.4 and later iOSiOS 9.0 and later Windows UWPWindows 10 Windows StoreWindows 8.1 or later Windows Phone StoreWindows Phone 8.1 or later Windows Phone SilverlightWindows Phone 8.1 or later
示例#1
0
 private void AddToScheduleImpl(ScheduledToastNotification scheduledToast)
 {
     if (s_granted)
     {
         scheduledToast._request = UNNotificationRequest.FromIdentifier(Guid.NewGuid().ToString(), scheduledToast._content, scheduledToast._trigger);
         UNUserNotificationCenter.Current.AddNotificationRequest(scheduledToast._request, null);
     }
 }
示例#2
0
 private void RemoveFromScheduleImpl(ScheduledToastNotification scheduledToast)
 {
     if (s_granted)
     {
         if (scheduledToast._request != null)
         {
             UNUserNotificationCenter.Current.RemovePendingNotificationRequests(new string[] { scheduledToast._request.Identifier });
         }
     }
 }
示例#3
0
        /// <summary>
        /// Adds a <see cref="ScheduledToastNotification"/> for later display.
        /// </summary>
        /// <param name="scheduledToast">The scheduled toast notification, which includes its content and timing instructions.</param>
        public void AddToSchedule(ScheduledToastNotification scheduledToast)
        {
#if __MAC__
            NSUserNotificationCenter.DefaultUserNotificationCenter.ScheduleNotification(scheduledToast);
#elif __UNIFIED__
            AddToScheduleImpl(scheduledToast);
#elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81
            _notifier.AddToSchedule(scheduledToast._notification);
#else
            throw new PlatformNotSupportedException();
#endif
        }
示例#4
0
        /// <summary>
        /// Adds a <see cref="ScheduledToastNotification"/> for later display.
        /// </summary>
        /// <param name="scheduledToast">The scheduled toast notification, which includes its content and timing instructions.</param>
        public void AddToSchedule(ScheduledToastNotification scheduledToast)
        {
#if __ANDROID__
            throw new PlatformNotSupportedException();
#elif __IOS__
            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                UIApplication.SharedApplication.ScheduleLocalNotification(scheduledToast._localNotification);
            });
#elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81
            _notifier.AddToSchedule(scheduledToast._notification);
#elif WINDOWS_PHONE
            throw new PlatformNotSupportedException();
#endif
        }