-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDownlaod file.cs
41 lines (33 loc) · 1.17 KB
/
Downlaod file.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Net;
using System.ComponentModel;
namespace Droid_NG___2._0
{
class Downlaod_file
{
public static string path;
public static string progress = "■";
public static void Get(string url,string savepath)
{
path = savepath;
WebClient webClient = new WebClient();
webClient.DownloadFile(url, @""+savepath);
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
}
public static void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
Console.WriteLine(progress);
}
public static void Completed(object sender, AsyncCompletedEventArgs e)
{
Console.WriteLine("Download Has Finshed!");
Console.WriteLine("Right Here At " + path);
}
}
}