7
我有用c#编写的Windows Metro应用程序。存储文件到系统uri?
这里是我使用从本地音乐库中选择一个文件中的代码:
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary;
openPicker.FileTypeFilter.Add(".mp3");
openPicker.FileTypeFilter.Add(".wav");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
myMediaElement.Source = file; //error here
}
else
{
//error here
}
它说,StorageFile
不能转换为用于改变MediaElement的源System.Uri
。我如何使我的文件成为一个URI链接?看起来Uri("...")
只接受文件位置所在的String
。
确实很有帮助! – 2013-05-13 20:46:07