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() + "%";
        }

 

相关文章:

  • 2021-09-05
  • 2022-02-12
  • 2021-08-26
  • 2022-12-23
  • 2021-07-04
  • 2021-12-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案