日期:2014-05-17 浏览次数:20871 次
bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerAsync(temp); private void bw_DoWork(object sender, DoWorkEventArgs e) { ftp 下载 }
------解决方案--------------------
比如用webclient
WebClient wc = new WebClient(); byte[] data = new byte[10]; wc.UploadDataCompleted += new UploadDataCompletedEventHandler(wc_UploadDataCompleted); wc.UploadDataAsync(new Uri("http://www.sina.com.cn"), data);