2013-03-08 27 views
0

我希望將個人資料照片保存在localstorage上的文件中。保存聯繫人文件上的縮略圖

使用此代碼檢索IRandomAccessStreamWithContentType但我不明白如何將其保存在磁盤上。

var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker(); 
contactPicker.CommitButtonText = "Select"; 

var contact = await contactPicker.PickSingleContactAsync(); 

using (IRandomAccessStreamWithContentType stream = await contact.GetThumbnailAsync()) 
{ 
    //Save stream on LocalFolder 
} 

回答

-1

假設IRandomAccessStreamWithContentType像任何其他數據流,這應該做的伎倆:

using (IRandomAccessStreamWithContentType stream = await contact.GetThumbnailAsync()) 
{ 
    using(FileStream fs = new FileStream("path", FileMode.CreateNew)) 
    { 
      stream.CopyTo(fs); 
    } 
} 
相關問題