如何使用C#在窗口8中的后台任务中下载图像?问题是代码是中断但是没有任何异常? [英] How to download image in background task in window 8 using C#? the problem is code is break but m not getting any exception ?

查看:65
本文介绍了如何使用C#在窗口8中的后台任务中下载图像?问题是代码是中断但是没有任何异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string internetUri = SampleItemList [(int)isoSetting.Values [ItemList] + 1] .ImageLink;

StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;

StorageFile file = await folder.CreateFileAsync(myImage+((int)isoSetting.Values [RefreshCount] - 1)+.jpg,CreationCollisionOption.ReplaceExisting);

var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();

DownloadOperation d = downloader.CreateDownload(new Uri(internetUri),file);

await d.StartAsync ();

string internetUri = SampleItemList[(int)isoSetting.Values["ItemList"]+1].ImageLink;
StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile file = await folder.CreateFileAsync("myImage" + ((int)isoSetting.Values["RefreshCount"]-1) + ".jpg", CreationCollisionOption.ReplaceExisting);
var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();
DownloadOperation d = downloader.CreateDownload(new Uri(internetUri), file);
await d.StartAsync();

推荐答案

这篇关于如何使用C#在窗口8中的后台任务中下载图像?问题是代码是中断但是没有任何异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆