url에서 다운로드 한 BitmapImage를 app StorageFolder에 저장하려고합니다. 나는 나를 위해 테 이미지를 저장하는 함수를 만들려고 노력했다.C# Windows Phone 8 BitmapImage를 StorageFolder에 저장하는 방법
public async Task<string> savePhotoLocal(BitmapImage photo, string photoName)
{
var profilePictures = await storageRoot.CreateFolderAsync("profilePictures", CreationCollisionOption.OpenIfExists);
var profilePicture = await profilePictures.CreateFileAsync(photoName+".jpg", CreationCollisionOption.ReplaceExisting);
byte[] byteArray = new byte[0];
using (MemoryStream stream = new MemoryStream())
{
using (Stream outputStream = await profilePicture.OpenStreamForWriteAsync())
{
await stream.CopyToAsync(outputStream);
}
}
return profilePicture.Path;
}
하지만이 작동하지 않습니다와 나는 다시 오류를하지 않기 때문에 여기에서 잘못가는 뭐죠 내가 정말 모르는 : 이것은 내가 지금까지 무엇을 가지고 있습니다. 어떤 도움이나 코드 샘플도 좋을 것입니다. 다음
linkRequest = (HttpWebRequest)WebRequest.Create(uri);
linkRequest.Method = "GET";
WebRequestState webRequestState = new WebRequestState(linkRequest, additionalDataObject);
linkRequest.BeginGetResponse(client_DownloadImageCompleted, webRequestState);
과 :
는 HttpWebRequest를 통해 이미지를 다운로드 :
빠른 응답 주셔서 감사하지만 profilePicture 당신이 스트림에 대한 열려고하면 그 문자열이 불가능합니다. – apero
StoreForApplication을 설명해 주시겠습니까? 나는 이것에 대한 오류를 얻는다. 그것은 IsolatedStorageFile isf를 요구하지만, 이것이 무엇인지 전혀 모른다. – apero