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); } }
private void RemoveFromScheduleImpl(ScheduledToastNotification scheduledToast) { if (s_granted) { if (scheduledToast._request != null) { UNUserNotificationCenter.Current.RemovePendingNotificationRequests(new string[] { scheduledToast._request.Identifier }); } } }
/// <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 }
/// <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 }