• 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() + "%";
            }
    
  • 相关阅读:
    Python程序执行时的不同电脑路径不同问题
    Python写的计算器程序(主要目的在于熟悉下正则表达式)
    占位符
    selenium自动化测试浏览器驱动安装(属于转载文章)
    python的pip升级问题
    索引
    视图
    事务
    引擎
    约束
  • 原文地址:https://www.cnblogs.com/yhdkzy/p/2982321.html
Copyright © 2020-2023  润新知