【发布时间】:2013-09-25 15:02:13
【问题描述】:
我有一个音频文件存储在IsolatedStorage..
我想通过调用另一个类的方法来访问它:
using (IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = isolatedStorage.OpenFile(filePath, FileMode.Open, FileAccess.Read))
{
return fileStream;
}
}
现在当我以这种方式调用该方法时:
var fileStream = Musics.TryGetMusic("DaDaDa.mp3");
musicMediaElement.SetSource(fileStream);
musicMediaElement.Play();
我收到一条错误消息,提示它无法读取已关闭的文件。
原因是我正在使用using 语句并且当我调用Play() 时文件已关闭。
我该如何解决这个问题?
【问题讨论】:
标签: c# windows-phone-7 windows-phone-8 windows-phone isolatedstorage