私はこのようなファイルをダウンロードしようとしました:
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;
}
}
しかし、代わりに自分のイベントを呼び出す方法がわかりませんDownloadFileCompleted
それがうんざりする質問ならごめんなさい