Skip to main content
1 de 2
Leodev
  • 1.4k
  • 1
  • 10
  • 16

No se si servirá para tus fines, pero puedes descargar archivos con el siguiente método:

string REMOTE_FILE_PATH = "https:\\......lo-que-sea.zip";
string LOCAL_FILE_PATH = Combo_Ubication.Text + $@"\{video.Title}.mp3";

private void DownloadNow()
{
    //using System.Net;
    WebClient client = new WebClient();
    Uri uri = new Uri(REMOTE_FILE_PATH);
    client.DownloadProgressChanged +=client_DownloadProgressChanged;
    client.DownloadFileCompleted += client_DownloadFileCompleted;
    client.DownloadFileAsync(uri, LOCAL_FILE_PATH);
}

void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
    pbStatus.IsIndeterminate = false;
    pbStatus.Value = (double)e.ProgressPercentage;
    Console.WriteLine("TRANSFERIDO: " + (double)e.ProgressPercentage);
}

void client_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
    pbStatus.IsIndeterminate = true;
    MessageBox.Show("Listo!");
    //using System.Diagnostics;
    Process.Start(LOCAL_FILE_PATH);  
}

Suerte!

Leodev
  • 1.4k
  • 1
  • 10
  • 16