public async Task <byte[]> LoadImageData(string url, bool isNeededResize) { string filePath = null; if (_dictCacheImages.ContainsKey(url)) { string value = null; bool result = _dictCacheImages.TryGetValue(url, out value); if (result) { filePath = value; } } else { _index++; filePath = await _platformService.DownloadAndCacheImage(_index, url); if (filePath != null) { if (_dictCacheImages.ContainsKey(url)) { _dictCacheImages.Remove(url); } _dictCacheImages.Add(url, filePath); } } if (filePath != null) { if (isNeededResize) { return(await _platformService.ReadFileAndResize(filePath, IMAGESIZE_THUMB)); } else { return(await _platformService.ReadFile(filePath)); } } return(null); }