private void Download() { try { CloseProgress += new CloseProgressDelegate(FrmUpdate_closeProgress); if (Zips.Length > 0) { WC = new WebClient(); WC.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_downloadProgressChanged); WC.DownloadFileCompleted += new AsyncCompletedEventHandler(wc_downloadFileCompleted); WC.DownloadFileAsync(new Uri(Url + Zips[ZipsIndex]), Zips[ZipsIndex]); } else { FrmUpdate_closeProgress();//调用关闭进度条事件 } }catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 下载更新 /// </summary> private void DownLoad() { try { CloseProgress += new CloseProgressDelegate(FrmUpdate_CloseProgress); if (zips.Length > 0) { wc = new WebClient(); string urlpath = url + zips[zipsIndex]; wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged); wc.DownloadFileCompleted += new AsyncCompletedEventHandler(wc_DownloadFileCompleted); wc.DownloadFileAsync(new Uri(urlpath), zips[zipsIndex]); } else { FrmUpdate_CloseProgress();//调用关闭进度条事件 } } catch (Exception ex) { MessageBox.Show(ex.Message); } }