Fast and powerful image loader with memory and storage caching for your Windows Phone 7+ projects!
(Many ideas were taken from UniversalImageLoader for Android)
<Image Source="{Binding YourImageUri, Converter={StaticResource MyAppJetImageLoaderConverter}}"/>
1) Easy to add to your project and start using it in only 4 simple steps:
1.1) Add reference to JetImageLoader.dll or use nuget: PM> Install-Package WP-JetImagLoader
1.2) Extend JetImageLoaderConverter and configure it:
public class MyAppJetImageLoaderConverter : BaseJetImageLoaderConverter { protected override JetImageLoaderConfig GetJetImageLoaderConfig() { return new JetImageLoaderConfig.Builder { IsLogEnabled = true, CacheMode = CacheMode.MemoryAndStorageCache, DownloaderImpl = new HttpWebRequestDownloader(), MemoryCacheImpl = new WeakMemoryCache(), StorageCacheImpl = new LimitedStorageCache(IsolatedStorageFile.GetUserStoreForApplication(), "\\image_cache", new SHA1CacheFileNameGenerator(), 1024 * 1024 * 10), // == 10 MB }.Build(); } }
1.3) Declare MyAppJetImageLoaderConverter in App.xaml:
````...````
1.4) Set it as Converter for Image:
````````
aaand that is all, now it can load images from network, cache them in memory and storage and then load them from cache!
2) You can use your own implementations:
Downloader implementation — just implement IDownloader interface Memory cache implementation — just extend BaseMemoryCache abstract class Storage cache implementation — just extend BaseStorageCache abstract class
3) JetImageLoader already has basic implementations for all this things:
1 Downloader implemetation — HttpWebRequestDownloader based on HttpWebRequest class 1 Memory cache implementation — WeakMemoryCache based on WeakRefDictionary with weak references and auto GC cleaning (very cool) 2 Storage cache implementations — LimitedStorageCache with configurable limit in bytes to store on disk and stupid UnlimitedStorageCache implementation