繁体   English   中英

Windows Phone隔离存储错误

[英]windows phone isolated storage bug

我已尝试解决此问题

 if (File.Exists(data.FilePath))
 {
     AudioPlayer.Source = new Uri(data.FilePath, UriKind.RelativeOrAbsolute);
 }
 else
 {
     using (var storageFolder = IsolatedStorageFile.GetUserStoreForApplication())
     {
         using (var stream = new IsolatedStorageFileStream(data.FilePath, FileMode.Open, storageFolder))
         {
             AudioPlayer.SetSource(stream);
         }
     }
 }

如果我点击我的录音机音频会播放声音,但是如果我点击2次它会给我以下错误消息:

用户代码未处理IsolatedStorageException

mscorlib.ni.dll中发生类型'System.IO.IsolatedStorage.IsolatedStorageException的异常,但未在用户代码中处理

附加信息:不允许对IsolatedStorageFileStream进行操作。

添加此代码,然后尝试运行。

stream.Close();

默认情况下将Audioplayer.Source设置为null。 然后尝试一下。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM