I am using the following code to save the image in IsolateStorage:
String tempJPEG = "/Shared/Media/card.jpg";
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (myIsolatedStorage.FileExists(tempJPEG))
{
myIsolatedStorage.DeleteFile(tempJPEG);
}
IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG);
Extensions.SaveJpeg(bmp, fileStream, bmp.PixelWidth, bmp.PixelHeight, 0, 85);
fileStream.Close();
}
And this code to try to save the image in the gallery:
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("/Shared/Media/card.jpg", FileMode.Open, FileAccess.ReadWrite))
{
MediaLibrary mediaLibrary = new MediaLibrary();
mediaLibrary.SavePicture("SavedCard.jpg", fileStream);
fileStream.Close();
}
}
But when I try to run the app, it closes and Visual gives this error:
I've been trying to solve this problem for days. I found an example, however it uses image of the project itself, soon it is easy, in my case the image is of the project, however it is edited by the user and saved in IsolateStorage ..