我想在ScheduledAgent中更新闹钟开始时间,是否可以在wp7中执行此操作?
protected override void OnInvoke(ScheduledTask task)
{
var schedule = Find("AlarmName")
if (schedule != null)
{
var alarm = schedule as Alarm;
ReplaceAlarm(alarm);
}
NotifyComplete();
}
private void ReplaceAlarm(Alarm alarm)
{
alarm.BeginTime = NewDateTime;
alarm.ExpirationTime = NewExpirationTime;
alarm.Content = "new Text";
try
{
ScheduledActionService.Replace(alarm as ScheduledAction);
}
catch
{
}
}
提前感谢。
答案 0 :(得分:0)
这是不可能的,因为BackgroundAgent不支持 ScheduledActionService.Replace 方法。
http://msdn.microsoft.com/en-us/library/hh202962(v=vs.92).aspx