vendredi 23 novembre 2018

C# checkbox direct download file

I have trouble assinging a download to checkbox , for starters in the event of checking to download a specific file in the current folder. I plan to add cancel+delete on unchecked later... if I get this working The problem is that it creates an empty file , but the download never occurs. I really want it to download on check, without using a separate button that triggers the event.

public void downloadFile(String address, String filename)
    {
        WebClient down = new WebClient();
        down.DownloadFileAsync(new Uri(address), filename);
    }
    private void Autor_Checked(object sender, RoutedEventArgs e)
    {
        downloadFile("https://live.sysinternals.com/autoruns.exe", "autoruns.exe");
    }




Aucun commentaire:

Enregistrer un commentaire