public async void Run(IBackgroundTaskInstance taskInstance) { BackgroundTaskDeferral deferral = taskInstance.GetDeferral(); try { WallpaperService service = new WallpaperService(); Wallpaper wallpaper = await service.GetNewestWallpaperAsync(AppSetting.Area); if (wallpaper != null) { TileHelper.UpdatePrimaryTile(wallpaper); } } finally { deferral.Complete(); } }
private async Task UpdatePrimaryTile() { try { WallpaperService service = new WallpaperService(); Wallpaper wallpaper = await service.GetNewestWallpaperAsync(AppSetting.Area); if (wallpaper != null) { TileHelper.UpdatePrimaryTile(wallpaper); } } catch { // ignored } }