2011-12-21 73 views
0

我正在嘗試使用提醒api但沒有運氣。我用來創建提醒的代碼位於下方。發生的事情是,提醒沒有被觸發,直到我添加另一個提醒,在這一點舊的提醒立即去。我想這段代碼並沒有多少提示,因爲它幾乎是從微軟的提示貼上覆制粘貼的。但我不知道哪裏出了問題,可以以其他方式(我將發佈其他代碼片段,如果您有任何建議,其中問題可能在於)提醒只在添加新提醒時執行

Reminder notification = new Reminder(""+uniqueId); 
      notification.Title = "Title"; 
      notification.Content = "Content"; 
      notification.BeginTime = DateTime.Now.AddSeconds(10); 
      notification.RecurrenceType = RecurrenceInterval.None; 
      notification.NavigationUri = new Uri("/MyPage.xaml?id=" + uniqueId, UriKind.Relative); 

      // Register the reminder with the system. 
      ScheduledActionService.Add(notification); 

回答

0

好了沒有什麼錯的代碼。仿真器系統時間設置爲自動,但不知何故20分鐘錯誤導致奇怪的行爲。手動設置時間後,按預期工作。