store image into isolated storage in windows phone 7

后端 未结 1 1845
一向
一向 2020-12-21 06:03

Basically I am using Visual Studio/Expression Blend to do my app. Its works as in the user can select the picture that he/she wants to edit and after editing the user just h

相关标签:
1条回答
  • 2020-12-21 06:27

    This is the working version of the code

    private void saveButtonClick(object sender, RoutedEventArgs e)
    {
        try
        {
            using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (isf.FileExists("myImage.jpg"))
                    isf.DeleteFile("myImage.jpg");
                using (var 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);
        }
    }
    

    Here myImageElement is the Image Element in which you display the image.

    0 讨论(0)
提交回复
热议问题