-
StackOverflow 文档
-
uwp 教程
-
UWP 后台任务
-
任务
public sealed class BackgroundTask : IBackgroundTask {
private BackgroundTaskDeferral _deferral;
/// <summary>
/// Registers the listener to check if the button is pressed
/// </summary>
/// <param name="taskInstance">An interface to an instance of the background task. The system creates this instance when the task has been triggered to run.</param>
public async void Run(IBackgroundTaskInstance taskInstance) {
_deferral = taskInstance.GetDeferral();
//Do async operations here
_deferral.Complete();
}
}