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