【问题标题】:Execute a background task when I turn my PC on - Windows Store App打开电脑时执行后台任务 - Windows Store App
【发布时间】:2015-11-25 11:19:20
【问题描述】:

我的应用在装有 Windows 8.1 Pro 的平板电脑上运行。

我得到了锁屏访问权限:

  await BackgroundExecutionManager.RequestAccessAsync();

时间触发器在这些条件下运行我的后台任务(Internet 和 UserPresent):

         // adding condition
         SystemCondition internetCondition = new SystemCondition(SystemConditionType.InternetAvailable);
         SystemCondition userPresentCondition = new SystemCondition(SystemConditionType.UserPresent); 

         builder.AddCondition(internetCondition);
         builder.AddCondition(userPresentCondition);
         BackgroundTaskRegistration taskRegistration = builder.Register();

它可以正常工作,但是当我关闭我的设备时,它不会再次启动。

我应该添加哪个条件(如果可能的话)?

msdn 上的同样问题

【问题讨论】:

    标签: c# windows windows-store-apps background-task


    【解决方案1】:

    为了将来的使用,我修复了它添加另一个带有会话条件的系统触发器的后台任务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多