0
ダウンロードが完了したらサウンドファイルを再生しようとしていますが、私は仕事をしません。ここに私のクラス:C# - ファイルのダウンロードが完了したら何かします
private String url = "http://download2098.mediafire.com/aut75nnjxh6g/34h69ha3ka375p4/Fed-Up+-+Virus+%28online-audio-converter.com%29.wav";
private String file = @"C:\VirEDos\virus.wav";
public Sounder()
{
download();
}
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
if (!e.Cancelled)
{
play();
}
}
private void download()
{
using (WebClient webClient = new WebClient())
{
webClient.DownloadFile(url, file);
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);
}
}
private void play()
{
SoundPlayer player = new SoundPlayer(file);
player.Load();
player.Play();
}
私は輸入品とすべてのものを追加しましたが、それはなぜ機能していませんか?
は、これまでヒットさplayメソッドですか? – Karolis
'webClient.DownloadFileCompleted + = ..'という行は、ダウンロードが完了した後に*実行されません。ダウンロードを実行する前に試してみてください。 –
何も変更されていません – RageSkilln