0

我正在尝试通过共享媒体库中的照片,SharedMediaTask但我从GetPath(). 错误说:

错误 1“Microsoft.Xna.Framework.Media.MediaLibrary”不包含“GetPath”的定义和最佳扩展方法重载...

这是我通过以下方式共享照片的代码SharedMediaTask

//Open Saved image from isolated storage
IsolatedStorageFile Store = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream toShare = new IsolatedStorageFileStream(filePath1, FileMode.Open, FileAccess.ReadWrite, Store);

//Save image to media library
MediaLibrary library = new MediaLibrary();
library.SavePicture("Memefy_Photo", toShare);

//Open ShareMediaTask
var task = new ShareMediaTask();
task.FilePath = library.GetPath(); //<----THIS is where the error appears :(
task.Show();

此外,根据我的研究,我还使用它using Microsoft.Xna.Framework.Media.PhoneExtensions;来启用所需的功能。GetPath()

非常感谢任何指导。

4

1 回答 1

1

GetPath是在图片上定义的,而不是在媒体库上定义的。

//Save image to media library
MediaLibrary library = new MediaLibrary();
var picture = library.SavePicture("Memefy_Photo", toShare);

//Open ShareMediaTask
var task = new ShareMediaTask();
task.FilePath = picture.GetPath();
task.Show();
于 2013-11-12T13:45:52.567 回答