首页 新闻 搜索 专区 学院

WP8 IsolatedStorageFileStream报错

0
[待解决问题]

如题,报错

Operation not permitted on IsolatedStorageFileStream

代码如下:

void _cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
        {
            string fileName = DateTime.Now.ToShortTimeString() + ".jpg";

            _library.SavePictureToCameraRoll(fileName, e.ImageStream);

            e.ImageStream.Seek(0, SeekOrigin.Begin);

            using (IsolatedStorageFile isStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (!isStore.FileExists(fileName))
                {
                    using (IsolatedStorageFileStream targetStream = isStore.OpenFile(fileName, FileMode.OpenOrCreate, FileAccess.Write))
                    {
                        byte[] readBuffer = new byte[4096];
                        int bytesRead = -1;

                        while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
                        {
                            targetStream.Write(readBuffer, 0, bytesRead);
                        }
                    }
                }

            }
            e.ImageStream.Close();
        }

 

 

当真是无法解决,甚是苦恼,有经验的同学帮助下,谢谢啦

UncleNull的主页 UncleNull | 初学一级 | 园豆:3
提问于:2014-06-21 15:34
< >
分享
所有回答(1)
0

是文件路径名称不对

UncleNull | 园豆:3 (初学一级) | 2014-07-09 13:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册