1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
private void button1_Click(object sender, EventArgs e)
{
if (checkBox_chrome.Checked)
{
MessageBox.Show("Chrome");
}
else
if (checkBox_firefox.Checked)
{
try
{
// Ouverture du dossier C:\Temp
System.Diagnostics.Process.Start(@"C:\temp");
// Lancement du telechargement de Firefox
WebClient webClient = new WebClient();
webClient.DownloadProgressChanged += (s, f) =>
{
progressBar.Value = f.ProgressPercentage;
progresslabel.Text = ("Telechargement de Firefox en cours...");
progresslabel.Visible = true;
};
webClient.DownloadFileCompleted += (s, f) =>
{
progressBar.Value = 0;
progresslabel.Visible = false;
};
webClient.DownloadFileAsync(new Uri("http://lb.cdn.m6web.fr/d/c/a/da11bf95f88f1defdde84dbc1761d83e/58210294/soft/logiciel/mozilla-firefox_49-0-2_fr_11003_32.exe"), @"c:\temp\Firefox45.0.1.exe");
}
catch
{
MessageBox.Show("Il n'existe pas de repertoire temp à la racine de C:", "Oups", MessageBoxButtons.OK);
}
}
else
MessageBox.Show("Veuillez cochez au moins une option !", "S.V.P");
} |
Partager