2013-12-16 69 views
0

正試圖與ShareMediaTask共享圖像。windows phone 8 ShareMediaTask例外

所有的東西,除了工作達到共享應用我的應用程序崩潰,應用unhand導致異常

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"); 
     } 

與郵件一樣也達到了在後臺郵件應用程序崩潰的選擇視後之後。

+0

您能提供異常的說明嗎? –

+0

類型'System.Windows.Media.Transform'不能被序列化。考慮使用DataContractAttribute屬性標記它,並使用DataMemberAttribute屬性標記要序列化的所有成員。或者,您可以確保Type'System.Windows.Media.Transform'不能被序列化。考慮使用DataContractAttribute屬性標記它,並使用DataMemberAttribute屬性標記要序列化的所有成員。 –

回答

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();