我正在尝试将列表框中的选定图片保存到手机的内存中,但我不明白为什么我会收到“InvalidOperationException was Unhandled”错误。
var filePath = "Uploads/" + fileListBox.SelectedItem;
var fileUriSource = new Uri(filePath, UriKind.Relative);
using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(filePath.ToString(), FileMode.Open))
{
MediaLibrary mediaLibrary = new MediaLibrary();
Picture pic = mediaLibrary.SavePicture("saved" + filePath.ToString(), fileStream);
fileStream.Close();
}
}
我已经在互联网上搜索,但我找不到任何答案。任何帮助都会很棒。
谢谢!