protected override async Task <ImageSource> LoadImage(bool removeCache, CancellationToken token) { var src = await ScriptGalleryReadingImageCache.Instance.GetFromCacheAsync(_link, Task.Run <Stream>(async() => { var result = await _api.GetImageFromImagePage(_link); return(new MemoryStream(Encoding.UTF8.GetBytes(result))); }, token), cancellationToken : token); if (removeCache) { await ScriptGalleryReadingImageCache.Instance.RemoveAsync(new[] { _link }); await ProgressImageCache.Instance.RemoveAsync(new[] { new Uri(src), }); src = await ScriptGalleryReadingImageCache.Instance.GetFromCacheAsync(_link, Task.Run <Stream>(async() => { var result = await _api.GetImageFromImagePage(_link); return(new MemoryStream(Encoding.UTF8.GetBytes(result))); }, token), cancellationToken : token); } return(await ProgressImageCache.Instance.GetFromCacheAsync(new Uri(src), cancellationToken : token, progress : this)); }