zoukankan      html  css  js  c++  java
  • webclient下载+进度

    public DownTemplateView()
            {
                InitializeComponent();
                System.Net.WebClient c = new System.Net.WebClient();
                string path = Environment.CurrentDirectory + "\\Record\\" + CommonHelper.ClassID + "\\";
                if (!System.IO.Directory.Exists(path))
                    System.IO.Directory.CreateDirectory(path);
                c.DownloadFileAsync(new Uri(CommonHelper.TemplateDownPath), path+ System.IO.Path.GetFileName(CommonHelper.TemplateDownPath));
                c.DownloadProgressChanged += new System.Net.DownloadProgressChangedEventHandler(c_DownloadProgressChanged);
                c.DownloadFileCompleted += new AsyncCompletedEventHandler(c_DownloadFileCompleted);
                c.Proxy = WebRequest.DefaultWebProxy;
            }
            void c_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
            {
                MessageBox.Show("ok");
            }
            void c_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
            {
                prcs.Value = e.ProgressPercentage;
                this.label1.Content = "已完成:" + prcs.Value.ToString() + "%";
            }
    
  • 相关阅读:
    ble_app_hrs心率程序 nrf51822
    2019.05.08 《Linux驱动开发入门与实战》
    函数指针
    typedef
    回调函数
    android2
    android1
    每周总结2
    HTML
    数组(续)
  • 原文地址:https://www.cnblogs.com/yhdkzy/p/2982321.html
Copyright © 2011-2022 走看看