Etat téléchargement par evenement en c++/cli
Bonjour a toutes et tous
Voila j'ai un problème pour récupérer l'état d'avancement d'un téléchargement en c++/cli.
J'ai trouver dans la msdn ce bout de code pour récupérer par évènment l'etat d'avancement du telechargement seulemen c'est en C# et je n'arrive pas a l'adapter en c++/cli.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
// Sample call : DownLoadFileInBackground2 ("http://www.contoso.com/logs/January.txt");
public static void DownLoadFileInBackground2 (string address)
{
WebClient client = new WebClient ();
Uri uri = new Uri(address);
// Specify that the DownloadFileCallback method gets called
// when the download completes.
client.DownloadFileCompleted += new AsyncCompletedEventHandler (DownloadFileCallback2);
// Specify a progress notification handler.
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);
client.DownloadFileAsync (uri, "serverdata.txt");
} |
Voila mon code en c++/cli:
Code:
1 2
| objclient->DownloadFileCompleted += gcnew System::ComponentModel::AsyncCompletedEventHandler(ProgressBarCompleted);
objclient->DownloadProgressChanged += gcnew System::Net::DownloadProgressChangedEventHandler(ProgressBar); |
J'appelle les méthodes ProgresBarCompleted et ProgressBar qui ce charge de faire varier l'état de la progressBarre.
Le problème c'est que sa ne compile pas :roll:
Merci d'avance pour ceux qui ce donneront la peine de m'aider encore un fois.