Skip to main content

Caching Images downloaded from web on Windows Phone Isolated storage



I was helping on a Windows Phone application where the requirement was to cache the images the phone downloads on the isolated storage for offline viewing.
I wanted a solution which was simple and as transparent as possible. While researching I found  someone wrote a Silverlight converter for loading images from isolated storage. Taking that as a base I created a converted which can
  1. Load image from web (http + https), and persist it to isolated storage.
  2. In case of network connectivity issues can load the same image from isolated storage. It does that by mapping the http url to a isolated storage location.
  3. In case the network is down and the image is neither there in cache, loads a default image, passed as parameter to converter.
Here is the gist for the implementation.


To use the converter
  1. Import the name space.
  2. Declare the converter as resource.
  3. Set the Image Source Property to use this converter like this 

Comments

chandermani said…
This may be due to eventhandlers getting attached multiple time. Look at your code and verify.
Ich said…
Do you have an example project to download?
chandermani said…
No, this was part of a WP app that we build.Sorry :(
artem_zin said…
Hi, I want to share my JetImageLoader library, it can load images then cache it in memory and on the disk and it can be used via Bindings!


You can check out sample and lib on the github: https://github.com/artem-zinnatullin/jet-image-loader

Also, you can install it using NuGet: Install-Package WP-JetImagLoader
Deep Negasi said…
What is ImageFilePathConverter? which is u mention in image souce property. Please explain that.
chandermani said…
This is the same converter that i have created about, it has been referenced as ImageFilePathConverter
Anonymous said…
Social marketing foor a business is all about making money.
This allocation provides a spectrum band for short-range medical technologies
to facilitate very reliable low-power operation. For the normal end-user, these cloud-based services
come in the form of Apple's i - Cloud and , being cost
effective and intuitibe solutions even if users are
just using wireless Internet.

Popular posts from this blog

Angularjs and inplace edit

AngularJS is an awesome framework and Angular Directives make this framework super awesome :) AngularJS  directives help us extend the existing HTML DSL. You can create new tags, extend functionality using existing tag and create reusable component. I recently created a Inplace editable control in AngularJS. It basically allows to do in place editing for elements like H1, H2, H3 div etc, basically all read only control. I took the initial idea from this fiddle and added Text selection on edit. Cursor positioning Handle the Enter key press. Here is my fiddle

Appharbor build notification using Google Talk (XMPP)

Appharbor recently ran a contest to encourage developers to use their API and showcase the API capabilities. Based on some ideas floated by the Appharbor team I too decided to build something useful\interesting for Appharbor platform.I decided to create a desktop notification client which can notify user when the build is complete, its status in terms of success or failure. How Appharbor works is that you push your code to a git repo supported by Appharbor ( github , bitbucket etc). As soon as the checkin is done, Appharbor pulls the code base build it, and updates the running website. It's like a single click deployment! I started to explore my option for a desktop client and some of the options I though of were Build a desktop windows app and integrate with the Appharbor API.  This approach was the most flexible approach. I have full control of features and capabilities, but would take a good amount of time to develop. Use third party desktop notification apps like