2
在我的應用Application_Exit事件中,我試圖使用ScheduledActionService設置鬧鐘。這部作品在其他代碼不錯,但在這裏它保持與消息E_INVALIDARG在Windows Phone 7中設置鬧鐘
這裏拋出一個ArgumentException是代碼
string alarmName = Guid.NewGuid().ToString();
const string cookingClockAlarm = "Cooking clock alarm";
DateTime dueTime = DateTime.Now.AddSeconds(10);
var alarm = new Alarm(alarmName)
{
Content = cookingClockAlarm,
BeginTime = dueTime,
ExpirationTime = dueTime.AddSeconds(3),
RecurrenceType = RecurrenceInterval.None
};
// Register the alarm with the system.
ScheduledActionService.Add(alarm);//here I get an exception
任何想法,我做錯了什麼?
有趣的是,我在調用ScheduledActionService.Find時遇到了與應用程序關閉時相同的問題。 http://stackoverflow.com/questions/10510152/scheduledactionservice-find-throws-argumentexception – 2012-06-09 07:51:55