0
votes

my codes are able to work for saving 1 image into the isolated storage in windows phone 7 but how to change it so that it able to save more than 1 images into the isolated storage.For now, whenever i wanted to save a new image the newest image will overlap the old image so anyone could help me to change my code or with sample that works.Thanks alot

My code :

 private void saveButtonClick(object sender, RoutedEventArgs e)
    {
        try
        {
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (isf.FileExists("myImage.jpg"))
                    isf.DeleteFile("myImage.jpg");

                using (IsolatedStorageFileStream isfs = isf.CreateFile("myImage.jpg"))
                {
                    var bmp = new WriteableBitmap(myImageElement, myImageElement.RenderTransform);
                    bmp.SaveJpeg(isfs, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
                }
            }
        }
        catch (Exception exc)
        {
            MessageBox.Show(exc.Message);
        }
    }
1

1 Answers

1
votes

YOur files are being overwritten as you're giving each one the same name.
If you want multiple files they'll need to have unique names. Do this by removing the hardcoded name in your code and using appropriate/unique names for each file.