我想在 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
{
}
}
提前致谢。