title: Save and Load image from Isolated Storage (Windows Phone)
body: <p>I have found a very usefull class on this link: <a href="https://gist.github.com/2688372#file_cache_image_file_converter.cs%20%20images%20caching" rel="nofollow">images caching</a> - that help me to make logic for caching images. But in my case I have this:</p>
  
  <pre><code> private void DetailView_SelectionChanged(object sender, SelectionChangedEventArgs e)
              {
                                     SaveAndLoadImage(feedItem);
  
  
              }
  </code></pre>
  
  <p>And in this method I save and load image from isolated storage. But I can't load file imidiately because of some permission (Operation not permitted on IsolatedStorageFileStream.). How can I correct my logic to save and load images immediately?</p>
  
  <pre><code>  public void SaveAndLoadImage(MediaItemViewModel curItem)
              {
                  string url = string.Empty;
                  if (!string.IsNullOrEmpty(curItem.ThumbUrl))
                  {
                      url = curItem.ThumbUrl;
                  }
                  if ((string.IsNullOrEmpty(curItem.ThumbUrl)) &amp;&amp; (!string.IsNullOrEmpty(curItem.MediaUrl)))
                  {
                      url = curItem.MediaUrl;
                  }
                  if ((!string.IsNullOrEmpty(url)) &amp;&amp; (CacheImageFile.GetInstance().IsOnStorage(new Uri(url)) == false))
                  {
                      CacheImageFile.DownloadFromWeb(new Uri(url));
  
                  }
  
                      curItem.ImageSource = CacheImageFile.ExtractFromLocalStorage(new Uri(url)) as BitmapImage;
  
              }
  </code></pre>