public async Task <object> GetImage(Uri uri) { var filename = Uri.EscapeDataString(uri.AbsoluteUri); if (HasLocallyCachedCopy(uri)) { using (var o = await OpenStorage(filename, PCLStorage.FileAccess.Read)) { return(LoadImage(o)); } } else { using (var d = http.Get(uri)) using (var o = await OpenStorage(filename, PCLStorage.FileAccess.ReadAndWrite)) { d.CopyTo(o); } using (var o = await OpenStorage(filename, PCLStorage.FileAccess.Read)) { return(LoadImage(o)); } } }
public object GetImage(Uri uri) { var filename = Uri.EscapeDataString(uri.AbsoluteUri); if (HasLocallyCachedCopy(uri)) { using (var o = OpenStorage(filename, FileMode.Open)) return(LoadImage(o)); } else { using (var d = http.Get(uri)) using (var o = OpenStorage(filename, FileMode.Create)) d.CopyTo(o); using (var o = OpenStorage(filename, FileMode.Open)) return(LoadImage(o)); } }