好的,我有这个:
foreach (FileInfo fileinfo2 in Arquivos2)
{
label8.Text = "Enviando(NFe): " + fileinfo2.Name + "...";
label8.Update();
WebClient client = new WebClient();
client.Credentials = new System.Net.NetworkCredential(usuario, senha);
client.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgressCallback);
client.UploadFile(new Uri("ftp://" + ftp + "/" + caminho + "//nf//" + fileinfo2.Name), "STOR", @"C:\\NFe\" + fileinfo2.Name);
bar++;
backgroundWorker1.ReportProgress(bar);
}
它工作正常,但我有:
private void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
progressBar2.Value = e.ProgressPercentage;
progressBar2.Update();
}
并且progressBar2没有任何反应......
如何使用上传进度更新我的 progressBar2?我不能将 UploadFile 与 UploadProgressChanged 一起使用?