0
我有一个文件不会下载的问题,即使它显示为已完成。即使它说它没有下载文件
该文件没有显示在它应该被下载到的位置。
这是我的代码:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if(e.ColumnIndex == 2)
{
int rowIndex = e.RowIndex;
DataGridViewRow row = dataGridView1.Rows[rowIndex];
string value1 = row.Cells[2].Value.ToString();
wc.DownloadFileCompleted += new AsyncCompletedEventHandler(AtlasCompleted);
Uri fileUrl = new Uri(value1);
Beta = fileUrl;
//Console.WriteLine(FormPopup.Variables.Location1.Length);
if (FormPopup.Variables.Location1 != null && FormPopup.Variables.Location1.Length >= 5)
{
Console.WriteLine(FormPopup.Variables.Location1);
Console.WriteLine(fileUrl);
wc.DownloadFileAsync(fileUrl, FormPopup.Variables.Location1);
//MessageBox.Show(fileUrl.ToString() + " " + FormPopup.Variables.Location1);
}
else
{
MessageBox.Show("Error: No file location specified.");
FormPopup form = new FormPopup();
form.Show(this);
}
}
}
private void AtlasCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show(Beta.ToString() + " " + FormPopup.Variables.Location1);
}
该文件应该下载,但它不是下载或出现在指定的位置。
如果任何人都可以提供帮助,那就太棒了,它让我很困惑。
感谢您的答复:d
你在哪里指定保存文件的路径? AtlasCompleted被称为? –
我以另一种形式指定路径,将其保存在FormPopup.Variables.Location1下,它显示正确的路径,并且正在调用AtlasCompleted,但该文件没有找到的位置。 – ZiiM
我注意到一件事,该程序似乎即刻完成它。似乎没有时间。 – ZiiM