파일 이름 얻을 DownloadFileCompleted :웹 클라이언트는이 같은 파일을 다운로드하려고
WebClient _downloadClient = new WebClient();
_downloadClient.DownloadFileCompleted += DownloadFileCompleted;
_downloadClient.DownloadFileAsync(current.url, _filename);
// ...
을 그리고 난 다운로드 파일을 다른 프로세스를 시작해야합니다 다운로드 후, 나는 DownloadFileCompleted
이벤트를 사용하려고 노력했다.
void DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
if (e.Error != null)
{
throw e.Error;
}
if (!_downloadFileVersion.Any())
{
complited = true;
}
DownloadFile();
}
하지만, 내가 AsyncCompletedEventArgs
에서 다운로드 한 파일의 이름을 알 수 없다, 내가 만든 내 자신의
public class DownloadCompliteEventArgs: EventArgs
{
private string _fileName;
public string fileName
{
get
{
return _fileName;
}
set
{
_fileName = value;
}
}
public DownloadCompliteEventArgs(string name)
{
fileName = name;
}
}
그러나 나는 그것이 NOOD 질문
의 경우 대신DownloadFileCompleted
미안 내 이벤트를 호출하는 방법을 이해할 수 없다
http://msdn.microsoft.com/en-us/library/17sde2xt(v=VS.100).aspx – Leri
아마도 전역 변수 – VladL
어떻게 사용 이벤트 =) 알고 내 이벤트 대신 내 이벤트를 사용하십시오 .Art EventArgs와 함께 DownloadFileCompleted – user1644087