private void BlackHelper_Progress(object sender, HttpHelper.DownloadProgressEventArgs e) { if (e.State == eDownloadSta.STA_FINISH) { string[] black = System.IO.File.ReadAllText(tempPath2).Split('\n'); foreach (string name in black) { if (System.IO.File.Exists(downPath + @"\" + name)) { File.Delete(downPath + @"\" + name); } } } }
private void Helper_Progress(object sender, HttpHelper.DownloadProgressEventArgs e) { if (helper.FullSize != 0) { Percent = e.CurrentSize / helper.FullSize * 100; } Reamin = Helper.RemainTime; if (e.State == eDownloadSta.STA_FINISH) { StatusText = "下载完成!"; } if (e.State == eDownloadSta.STA_ERR) { StatusText = "下载出错!"; } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Percent")); }
private void ListHelper_Progress(object sender, HttpHelper.DownloadProgressEventArgs e) { this.Dispatcher.BeginInvoke(new Action(() => { if (listHelper.FullSize != 0) { prgLoading.Value = e.CurrentSize / listHelper.FullSize * 100; } })); this.Dispatcher.BeginInvoke(new Action(() => { if (e.State == eDownloadSta.STA_FINISH) { string[] list = System.IO.File.ReadAllText(tempPath).Split('\n'); foreach (string n in list) { string[] s = n.Split('|'); if (s.Length == 2) { DownloadInfo inf = new DownloadInfo(); inf.Helper = new HttpHelper(new System.Timers.Timer()); inf.FileName = s[1]; inf.Url = s[0]; inf.StatusText = "等待下载..."; inf.Enabled = !System.IO.File.Exists(System.IO.Path.Combine(downPath, inf.FileName)); if (!inf.Enabled) { inf.StatusText = "已存在"; } infos.Add(inf); } } brdLoading.Visibility = Visibility.Collapsed; btnStart.Visibility = Visibility.Visible; try { System.IO.File.Delete(tempPath); } catch { } } })); }