/// <summary> /// Because the app has registered to support "Photos" extension the agent will be invoked /// and requested to download the album cover on a per need basis (e.g.: the user is /// browsing the album covers). We only recevie this operation it the album cover url is missing or /// the image binary is missing and the album is configured to require authentication /// (i.e. : we have explicitly set the property RequiresAuthentication = true) /// </summary> /// <param name="operation">The operation that we need to perform</param> private async Task ProcessOperation(DownloadAlbumCoverOperation operation) { Logger.Log("Agent", "DownloadAlbumCoverOperation(" + operation.AlbumId + ")"); try { OnlinePictureAlbum album = await manager.GetPictureAlbumByRemoteIdAsync(operation.AlbumId); if ((null != album.CoverImageUrl) && (!string.IsNullOrEmpty(album.CoverImageUrl.AbsolutePath))) { await album.SetCoverImageAsync(await Helpers.MakeStreamFromUrl(album.CoverImageUrl)); await manager.SavePictureAlbumAsync(album); } } catch (Exception e) { Helpers.HandleException(e); } finally { operation.SafeNotifyCompletion(); } }
/// <summary> /// Because the app has registered to support "Photos" extension the agent will be invoked /// and requested to download the album cover on a per need basis (e.g.: the user is /// browsing the album covers). We only recevie this operation it the album cover url is missing or /// the image binary is missing and the album is configured to require authentication /// (i.e. : we have explicitly set the property RequiresAuthentication = true) /// </summary> /// <param name="operation">The operation that we need to perform</param> private async Task ProcessOperation(DownloadAlbumCoverOperation operation) { Logger.Log("Agent", "DownloadAlbumCoverOperation(" + operation.AlbumId + ")"); try { OnlinePictureAlbum album = await manager.GetPictureAlbumByRemoteIdAsync(operation.AlbumId); if ((null != album.CoverImageUrl) && (!string.IsNullOrEmpty(album.CoverImageUrl.AbsolutePath))) { await album.SetCoverImageAsync(await Helpers.MakeStreamFromUrl(album.CoverImageUrl)); await manager.SavePictureAlbumAsync(album); } } catch (Exception e) { Helpers.HandleException(e); } finally { operation.SafeNotifyCompletion(); } }