[英]How to turn on the Scheduled Task Agent after it is off by battery saver in WP7?
我在WP7應用程序中添加了Scheduled Task Agent以定期提醒。 在2-3天后測試時,代理將關閉,即使我打開應用程序並再次啟動任務,它也不會再次返回。 以下是我在ScheduledTaskAgent中嘗試過的內容:
protected override void OnInvoke(ScheduledTask task)
{
DateTime time = DateTime.Now;
if (time.Hour > 6 && time.Hour < 23)
{
getContent();
if (task.Name.Equals("PeriodicTaskDemo", StringComparison.OrdinalIgnoreCase))
{
ShellToast toast = new ShellToast();
Mutex mutex = new Mutex(true, "ScheduledAgentData");
mutex.WaitOne();
IsolatedStorageSettings setting = IsolatedStorageSettings.ApplicationSettings;
toast.Title = setting["ScheduledAgentData"].ToString();
mutex.ReleaseMutex();
toast.Content = "You are being notified!!";
toast.Show();
}
NotifyComplete();
}
}
省電模式不會禁用后台任務再次啟動。 禁用代理的唯一原因:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.