mono touch下载文件到本地
来源:互联网 发布:网络上的静静图片 编辑:程序博客网 时间:2024/05/22 06:05
有不明白的地方欢迎入群 347636249 探讨
System.Threading.Thread.Sleep(500);
ExpertDownloadBind (this, TBView, tableItems, UserID, loadingimglist.ToArray ());
});
Task1.Wait ();
System.Threading.Thread.Sleep(1000);
TBView.Source = new TableSource (this, tableItems, UserID);
TBView.ReloadData ();
/// <summary>
/// 绑定数据并下载文件
/// </summary>
private void ExpertDownloadBind(UIViewController viewcontroller , UITableView tableview,
List<TableItem> listmodel, string userid, params string[] imgarr)
{
string _fullname = string.Empty; //存储文件名
for (int i = 0; i < imgarr.Length; i++) {
_fullname = imgarr [i].Substring (imgarr [i].LastIndexOf ("/") + 1);
string _cp = FileHelper.GetMyDocumentPath (KeyCenter.Key_LoadedImgPath);//获取图片文件夹路径
if (FileHelper.FileUploaded (_cp, _fullname))
continue; //已经下载过了就不下载
string tempimgurl = imgarr [i];
//LoadFile (tempimgurl);
new System.Threading.Thread (() => LoadFile (tempimgurl)).Start ();
}
}
void LoadFile(object fileurl)
{
string name = fileurl.ToString ();
var webClient = new WebClient();
webClient.DownloadDataCompleted += (s, e) => {
var bytes = e.Result; // get the downloaded data
string documentsPath = FileHelper.GetMyDocumentPath (KeyCenter.Key_LoadedImgPath);
string localFilename = name.Substring (name.LastIndexOf ("/") + 1);
string localPath = Path.Combine (documentsPath, localFilename);
File.WriteAllBytes (localPath, bytes); // writes to local storage
};
webClient.DownloadDataAsync(new Uri(name));
}
- mono touch下载文件到本地
- Mono Touch文件下载
- mono touch中下载列表图片到本地,优化显示速度
- 下载文件到本地
- java 下载文件到本地
- J2EE下载文件到本地
- 下载网页文件到本地
- java 下载文件到本地
- hdfs下载文件到本地
- servlet下载文件到本地
- H5 下载文件到本地
- lr下载文件到本地
- linux下载文件到本地
- jquery下载文件到本地
- Java文件下载到本地
- C++下载文件到本地
- H5 下载文件到本地
- 服务器下载文件到本地
- Filter-过虑器应用之1-设置request编码
- jpa注解
- Ubuntu JDK安装配置详解
- HTTP请求报文和HTTP响应报文
- jsoup
- mono touch下载文件到本地
- IT工作人员的几种生态
- Android 相机的开发注意事项
- 黑马程序员_集合知识总结
- poj 2762 Going from u to v or from v to u? (强连通+缩点+拓扑排序求解单项连通)
- C++设计模式10--命令模式(一)--降低请求发送者与接收者耦合
- java内存分配
- USART串口总结2
- 【10.1.1】ArcGIS Android 10.1.1 API——GraphicsLayer(编辑中)