Windows Phone上的多个预定敬酒
问题描述:
我正在写一个应用程序(Windows Phone 8),它必须在给定的时间显示多个敬酒。 为此,我使用一个“ScheduledTaskAgent”项目。如果我添加一个任务/面包,它正在Windows Phone上的多个预定敬酒
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);
}
:
protected override void OnInvoke(Microsoft.Phone.Scheduler.ScheduledTask task)
{
ShellToast toast = new ShellToast();
toast.Content = task.Description;
toast.Show();
NotifyComplete();
ScheduledActionService.Remove(task.Name);
}
,并增加了新的任务/敬酒我做的。但是,如果我想添加更多,我有一个System.InvalidOperationException。
(表示:BNS错误:此类型的ScheduledAction的最大数量已被添加。)。
我该如何改变这一点,以便能够在一项任务中添加敬酒。
更新时间:
我改变了我的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);
}
有没有办法使用烤面包而不是提醒?
答
如果你想提醒展现给用户在一个特定的时间,你有几种选择:
如果你想提高从设备,您可以使用Alert
或Reminder
通知。
如果要显示Toast
通知,您必须使用Push Notification
从远程来源发送此通知。
谢谢。我也这么想。我希望能够显示通知(例如Toast),但要以提醒的方式显示。 – David 2013-03-18 18:12:55
号码提醒使用提醒UI,不能显示为敬酒。 – 2013-03-18 18:16:23