尝试在Windows Phone中设置提醒时出现InvalidOperationException

时间:2012-03-02 09:51:15

标签: windows-phone-7 reminders

我试图设置提醒,并且我遇到了这个错误“BNS错误:尝试创建/更新请求时,操作的开始时间已经过去了。”

在论坛上搜索并使用谷歌搜索找到类似错误的答案,这就是我如何设置提醒,为(m_iSafe2> 0)条件触发异常

            if (m_bSafeAlert)
            {
            if (m_iSafe1 > 0)
            {
                date = dtStart.AddDays(m_iSafe1);
                date = date.Date + time;
                noOfDays = m_iUnsafe1 - m_iSafe1;

                Reminder Safe1Reminder = new Reminder("Safe1")
                {
                    BeginTime = date,
                    Title = "Reminder",
                    Content = "Reminder 1",
                };
                ScheduledActionService.Add(Safe1Reminder);                    
            }

            if (m_iSafe2 > 0) // exception fired
            {
                date = dtStart.AddDays(m_iSafe2);
                date = date.Date + time;
                noOfDays = m_iAvgCycleTime - m_iSafe2;

                Reminder Safe2Reminder = new Reminder("Safe2")
                {
                    BeginTime = date,
                    Title = "Reminder",
                    Content = "Reminder2",
                };
                ScheduledActionService.Add(Safe2Reminder);
            }

我哪里错了?

Alfah

1 个答案:

答案 0 :(得分:1)

您尝试使用已经过的预定时间创建提醒