private void pictureBox2_Click(object sender, EventArgs e) { FolderBrowserDialog Save = new FolderBrowserDialog();//Declaring the folder browsing dialog Save.RootFolder = Environment.SpecialFolder.Desktop;//setting to desktop if (Save.ShowDialog() == DialogResult.OK)//An if statement to to show the path in textbox { string Text = textBox1.Text.ToString();//formatting to string string[] arry = Text.Split('/');//splitting / string dad = arry[arry.Length - 1]; ad = dad.Remove(dad.Length - 5); label5.Text = dad; path = String.Format("{0}//{1}",Save.SelectedPath,ad); WebClient wb = new WebClient(); wb.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wb_DownloadProgressChanged); wb.DownloadFileCompleted += new AsyncCompletedEventHandler(wb_DownloadFileCompleted); wb.DownloadFileAsync(new Uri(textBox1.Text), path); timer1.Start(); } } void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { timer1.Stop(); DialogResult dr = MessageBox.Show("Yukl?m? bitmisdir! Icra olunsun?", "Bitdi!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { progressBar1.Value = 0; Process.Start(path); } } void wb_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { progressBar1.Value = e.ProgressPercentage; label7.Text = e.BytesReceived.ToString() + " bayt"; label6.Text = e.TotalBytesToReceive.ToString() + "bayt"; label8.Text = e.ProgressPercentage.ToString() + "%"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)