如何在wp7代理中更新警报启动日期?

时间:2012-05-27 04:43:06

标签: windows-phone-7 alarm scheduledactionservice

我想在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
        {
        }
    }

提前感谢。

1 个答案:

答案 0 :(得分:0)

这是不可能的,因为BackgroundAgent不支持 ScheduledActionService.Replace 方法。

http://msdn.microsoft.com/en-us/library/hh202962(v=vs.92).aspx