Windows.UI.Notifications.ToastNotifier.AddToSchedule C# (CSharp) Method

AddToSchedule() public method

public AddToSchedule ( [ scheduledToast ) : void
scheduledToast [
return void
		public extern void AddToSchedule([In] ScheduledToastNotification scheduledToast);
		public extern void RemoveFromSchedule([In] ScheduledToastNotification scheduledToast);

Usage Example

Esempio n. 1
0
        public void ScheduleReminderNotifications(ToastNotifier notifier, string userId)
        {
            foreach (var reminder in Reminders)
            {
                if (reminder.UserId != userId)
                {
                    continue;
                }
                var toast = ToastContentFactory.CreateToastText04();
                toast.TextHeading.Text = Title;
                toast.TextBody2.Text = Location;

                var reminderTime = Utilities.UnixTimeStampToDateTime(StartTime - reminder.Interval);
                var timeString = IntervalToString(StartDateTime - reminderTime);
                toast.TextBody1.Text = timeString;

                toast.Duration = ToastDuration.Long;
                toast.Audio.Loop = false;
                toast.Audio.Content = ToastAudioContent.Reminder;

                if (reminderTime < DateTime.Now)
                {
                    continue;
                }
                var scheduled = new ScheduledToastNotification(toast.CreateNotification().Content, reminderTime);
                
                notifier.AddToSchedule(scheduled);
            }
        }