У меня возникли проблемы с загрузкой файлов через приложение для работы с окнами. Вот мой метод для скачивания:Скачивание файла в приложении для магазина Windows
private static async void DownloadImage()
{
HttpClient client = new HttpClient();
HttpResponseMessage message = await client.GetAsync("http://coolvibe.com/wp-content/uploads/2010/05/scifiwallpaper1.jpg");
StorageFolder myfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile sampleFile = myfolder.CreateFileAsync("image.jpg", CreationCollisionOption.ReplaceExisting).GetResults();// this line throws an exception
byte[] file = await message.Content.ReadAsByteArrayAsync();
await FileIO.WriteBytesAsync(sampleFile, file);
var files = await myfolder.GetFilesAsync();
}
На отмеченной линии я получаю это исключение:
An exception of type 'System.InvalidOperationException' occurred in ListStalkerWin8.exe but was not handled in user code
WinRT information: A method was called at an unexpected time.
Additional information: A method was called at an unexpected time.
Что может быть причиной этого?
thnku очень много Марио Стойлов и Крис У. я тонул с этой проблемой – FebinDonz