Windows phone 7 将图像存储在后台的独立存储器中

Windows phone 7 将图像存储在后台的独立存储器中,windows-phone-7,Windows Phone 7,我正在开发一个应用程序,首先检查图像是否存在于独立存储中。如果图像不存在,则我首先下载,然后将其存储在独立存储中。但我遇到了一个类型为“System.ObjectDisposedException”的异常,该异常发生在mscorlib.ni.dll中,但在使用时未在用户代码中处理IsolatedStorageFileStream mystream=istore.CreateFileitem.ImageUrl 当您尝试创建文件时,看起来istore已被销毁。尝试在事件体中再次创建istore或手动

我正在开发一个应用程序,首先检查图像是否存在于独立存储中。如果图像不存在,则我首先下载,然后将其存储在独立存储中。但我遇到了一个类型为“System.ObjectDisposedException”的异常,该异常发生在mscorlib.ni.dll中,但在使用时未在用户代码中处理IsolatedStorageFileStream mystream=istore.CreateFileitem.ImageUrl


当您尝试创建文件时,看起来istore已被销毁。尝试在事件体中再次创建istore或手动使用全局变量和句柄dispose


例如:移动位图图像图像图像。。。在第一次使用和再次创建istore之外。

谢谢。这与您建议的问题是一样的,因为我可以存储在独立存储中的文件名非常大。
  private void checkimage(Model item)
    {
        using (IsolatedStorageFile istore = IsolatedStorageFile.GetUserStoreForApplication())
        {

            if (istore.FileExists(item.ImageUrl))
            {

            }
            else
            {
                BitmapImage imgage = new BitmapImage(new Uri(item.ImageUrl, UriKind.Absolute));
                imgage.CreateOptions = BitmapCreateOptions.BackgroundCreation;
                imgage.ImageOpened += (o, e) =>
                    {
                        using (IsolatedStorageFileStream mystream = istore.CreateFile(item.ImageUrl))
                        {
                            BitmapImage bitmap = new BitmapImage();
                            bitmap.SetSource(mystream);
                            WriteableBitmap wb = new WriteableBitmap(bitmap);

                            Extensions.SaveJpeg(wb, mystream, wb.PixelWidth, wb.PixelHeight, 0, 85);
                            mystream.Close();
                        }

                    };
               }
        }
        }