Windows phone 8 windows phone上的多个定时祝酒

Windows phone 8 windows phone上的多个定时祝酒,windows-phone-8,scheduled-tasks,Windows Phone 8,Scheduled Tasks,我正在编写一个应用程序(WindowsPhone8),它必须在给定的时间显示多个祝酒词。 为此,我使用了一个“ScheduledTaskAgent”项目 要添加新任务/祝酒词,我需要: private static void AddToSchedule(DateTime date, string id, Toast toast) { PeriodicTask periodicTask = new PeriodicTask(toast.Id); periodicTask.Des

我正在编写一个应用程序(WindowsPhone8),它必须在给定的时间显示多个祝酒词。 为此,我使用了一个“ScheduledTaskAgent”项目

要添加新任务/祝酒词,我需要:

 private static void AddToSchedule(DateTime date, string id, Toast toast)
{
    PeriodicTask periodicTask = new PeriodicTask(toast.Id);

    periodicTask.Description = toast.Title;
    ScheduledActionService.Add(periodicTask);
    var showIn = date - DateTime.Now;
    ScheduledActionService.LaunchForTest(toast.Id, showIn);
}
如果我添加了一个任务/土司,它将起作用。但如果我想添加更多,我有一个System.InvalidOperationException

(这意味着:BNS错误:已添加此类型的最大计划数。)

我如何更改此选项,以便能够在一项任务中添加祝酒词

更新:

我更改了AddToSchedule(),现在它可以工作了

 private static void AddToSchedule(DateTime date, string id, Toast toast)
{
    Reminder reminder = new Reminder(toast.Id);
    reminder.Title = toast.Title;
    reminder.Content = toast.Title;
    reminder.BeginTime = DateTime.Now.AddMinutes(1);
    reminder.ExpirationTime = reminder.BeginTime.AddSeconds(5.0);
    reminder.RecurrenceType = RecurrenceInterval.None;
    ScheduledActionService.Add(reminder);
}

有没有一种方法可以使用toast来代替提醒?

如果您希望在特定时间向用户显示提醒,您有几个选项:

如果要从设备发出通知,可以使用
警报
提醒


如果您想显示
Toast
通知,您必须使用
推送通知从远程源发送此通知

谢谢。我就是这么想的。我希望能够显示通知(如Toast),但方式与提醒相同。否。提醒使用提醒用户界面,不能使其显示为祝酒词。
 private static void AddToSchedule(DateTime date, string id, Toast toast)
{
    Reminder reminder = new Reminder(toast.Id);
    reminder.Title = toast.Title;
    reminder.Content = toast.Title;
    reminder.BeginTime = DateTime.Now.AddMinutes(1);
    reminder.ExpirationTime = reminder.BeginTime.AddSeconds(5.0);
    reminder.RecurrenceType = RecurrenceInterval.None;
    ScheduledActionService.Add(reminder);
}