windows phone 8 ShareMediaTask异常

时间:2013-12-16 10:43:43

标签: c# .net windows-phone-8

我正在尝试与ShareMediaTask共享图像。

除了到达共享应用程序后,所有内容都有效,我的应用程序因应用程序未处理的异常而崩溃

using (Stream current = await svfile.OpenStreamForWriteAsync())
        {
            var picture = lib.SavePicture("share", current);
            ShareMediaTask task = new ShareMediaTask();


            task.FilePath = picture.GetPath();

            task.Show();

            System.Diagnostics.Debug.WriteLine("yessss");
        }

在到达后台邮件应用程序崩溃的选择视图后也与邮件相同。

1 个答案:

答案 0 :(得分:0)

//Save image to media library
//toShare is the stream source. 
//Don't use using statement to get stream

MediaLibrary library = new MediaLibrary();
var picture = library.SavePicture("Memefy_Photo", toShare);

//Open ShareMediaTask
var task = new ShareMediaTask();
task.FilePath = picture.GetPath();
task.Show();