indirme programı
[code lang=”csharp”]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
namespace indirme_programı
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
WebClient değişken1 = new WebClient();
değişken1.DownloadFileAsync(new Uri(textBox1.Text),Application.StartupPath + @"\indirilen.exe");// tektboxa indirme adresi girilir ensondaki indirilen dosyanın adı olur
değişken1.DownloadFileCompleted += wcilent_DownloadFileCompleted;//indirmeyi tetikler ve indirme bittiğinde mesaj veriri
değişken1.DownloadProgressChanged += wcilent_DownloadProgressChanged;//indirmenin süresini durumunu bulur
}
void wcilent_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;//yukarda bulduğu durumu progressbar a aktarır
}
void wcilent_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("indirme başarıyla tamamlandı");// indirmeyi tetikleyen kodun devamı bitince bu mesajı verir
}
}
}
[/code]

