我正在使用 Scenario4 测试背景示例,它从不调用 Run,我正在按照步骤操作,这就是我所看到的:
1.- 打电话后
BackgroundTaskRegistration task = builder.Register();
任务有 Trigger = null
是否应该是之前指定的触发器
builder.SetTrigger(trigger); ?
2.-理论上,当我注册一个后台任务时,它应该出现在这里 EventViewer - BackgroundTaskInfrastructure 但它没有,应该出现在这里吗?
3.-尝试调试我调试位置-暂停应用程序但超过15分钟后它从未到达,应该像暂停和等待一样简单吗?
我还在运行通知中添加了:
var toastXML = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
var toastTextElements = toastXML.GetElementsByTagName("text");
toastTextElements.First().AppendChild(toastXML.CreateTextNode("Hello World:"));
var toastNotification = new ToastNotification(toastXML);
toastNotification.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(30);
ToastNotificationManager.CreateToastNotifier().Show(toastNotification);
但它永远不会出现。那么带有 TimeTrigger 的 BackgroundTask 是否有效?