欢迎光临
我的个人博客网站

WebClient,DownloadFileAsync,DownloadProgressChanged

static void Main(string[] args)         {             WebClientDownloadProgressChanged();             Console.ReadLine();         }          static void WebClientDownloadProgressChanged()         {             string url = "https://download.microsoft.com/download/d/1/c/d1c74788-0c6b-4d23-896e-67cf849d31ed/SSMS-Setup-ENU.exe";             using(WebClient wc=new WebClient())             {                 wc.DownloadProgressChanged += Wc_DownloadProgressChanged1;                 wc.DownloadFileAsync(new Uri(url), "ssms.exe");             }         }          private static void Wc_DownloadProgressChanged1(object sender, DownloadProgressChangedEventArgs e)         {             Console.WriteLine($"TotalBytesToReceive:{e.TotalBytesToReceive},BytesReceived:{e.BytesReceived},ProgressPercentage:{e.ProgressPercentage}");         }

WebClient,DownloadFileAsync,DownloadProgressChanged

 

赞(0) 打赏
未经允许不得转载:张拓的天空 » WebClient,DownloadFileAsync,DownloadProgressChanged
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

专业的IT技术经验分享 更专业 更方便

联系我们本站主机

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏