我試圖保存用FileOpenPicker選擇的圖像。當圖像被選中將圖像保存爲存儲文件
async void photoChooserTask_Completed(object sender, PhotoResult e)
{
// get the file stream and file name
Stream photoStream = e.ChosenPhoto;
string fileName = Path.GetFileName(e.OriginalFileName);
// persist data into isolated storage
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
using (Stream current = await file.OpenStreamForWriteAsync())
{
await photoStream.CopyToAsync(current);
}
}
我共進午餐這個事件,但這個代碼,這將給我保存的文件返回0
var properties = await file.GetBasicPropertiesAsync();
i = properties.Size;
難道我做錯了保存圖像的lenght?
檢查http://stackoverflow.com/questions/19886950/save-the-image-in-storage-file-in -windows-phone-8這個基本上是一樣的。 – loop
看到它,但沒有解決我的問題 – AnotherGeek
嗨,你沒有做任何錯誤的一切工作正常我測試了它。可能是問題不同,或者您在檢查時出錯。 plz交叉檢查它。在「i = properties.size」的下一行輸入一個斷點。 – loop