/// <summary> /// Runs the tile updater service. /// </summary> public async void Run(IBackgroundTaskInstance taskInstance) { // Try and register the rest of our background tasks: BackgroundTaskRegistrar.TryRegisterAllBackgroundTasks(); var deferral = taskInstance.GetDeferral(); CancellationTokenSource tokenSource = new CancellationTokenSource(); taskInstance.Canceled += (sender, reason) => tokenSource.Cancel(); try { await TileUpdaterService.UpdateTilesAsync(tokenSource.Token); } finally { deferral.Complete(); tokenSource.Dispose(); } }
/// <summary> /// Runs the tile updater service. /// </summary> public void Run(IBackgroundTaskInstance taskInstance) { BackgroundTaskRegistrar.UnregisterAllBackgroundTasks(true); }