public async void CacheFromFileAync(String file) { if (!_store.ContainsKey(file)) { Xamarin.Forms.ImageSource source = Xamarin.Forms.ImageSource.FromFile(file); var imageHandler = source.GetLoaderHandler(); if (imageHandler != null) { var nativeImage = await imageHandler.LoadImageAsync(source); if (nativeImage != null) { _store[file] = nativeImage; } } } }
public void CacheFromFile(String file) { if (!_store.ContainsKey(file)) { Xamarin.Forms.ImageSource source = Xamarin.Forms.ImageSource.FromFile(file); var imageHandler = source.GetLoaderHandler(); if (imageHandler != null) { var nativeImage = imageHandler.LoadImageAsync(source); if (nativeImage != null && nativeImage.Status != TaskStatus.Faulted) { _store[file] = nativeImage.Result; System.Diagnostics.Debug.WriteLine("PIC CACHED " + file); } } } }