0

I am developing an app in which I download images from the Web server and then store in Isolated Storage. However, I'm getting an error at BI.SetSource(Str_ri.Stream);

Here is my code:

string name = "image" + current.ImageId;
   using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
   {
      if (ISF.FileExists(name))
      {
      }
      else
      {
         IsolatedStorageFileStream filestream = ISF.CreateFile(name);
         StreamResourceInfo sr = null;
         Uri ur = new Uri(name, UriKind.Relative);
         sr = Application.GetResourceStream(ur);
         BitmapImage bi = new BitmapImage();
         bi.SetSource(sr.Stream);
         WriteableBitmap wr_B = new WriteableBitmap(bi);
         System.Windows.Media.Imaging.Extensions.SaveJpeg(wr_B, filestream, wr_B.PixelWidth, wr_B.PixelHeight, 0, 85);
         wr_B.SaveJpeg(filestream, wr_B.PixelWidth, wr_B.PixelHeight, 0, 85);
         filestream.Close();
      }
   }
lhan
  • 4,585
  • 11
  • 60
  • 105
Chetan Zope
  • 55
  • 1
  • 8

1 Answers1

1

I got my answer .Change bi.SetSource(sr.Stream); to bi.SetSource(filestream ); If you want more Detail then Follow how to store an image received from the web and display it in the windows phone 7 application

Community
  • 1
  • 1
Chetan Zope
  • 55
  • 1
  • 8