public WindowDetails(string movieid = "") { //movieid = "IPX-163"; InitializeComponent(); if (movieid != "") { vieModel = new VieModel_Details(); vieModel.Query(movieid); this.DataContext = vieModel; vieModel.QueryCompletedHandler += (s, e) => { BigImage.Source = vieModel.DetailMovie.bigimage; }; } else { this.DataContext = null; } AdjustWindow(); FatherGrid.Focus(); SetSkin(); }
public void StartDownload() { List <string> urlList = new List <string>(); foreach (var item in vieModel.DetailMovie.extraimageurl?.Split(';')) { if (!string.IsNullOrEmpty(item)) { urlList.Add(item); } } if (vieModel.DetailMovie.extraimagelist.Count >= urlList.Count & vieModel.DetailMovie.bigimage != null & vieModel.DetailMovie.title != "") { return; } //添加到下载列表 DetailDownLoad = new DetailDownLoad(vieModel.DetailMovie); DetailDownLoad.DownLoad(); Dispatcher.Invoke((Action) delegate() { ProgressBar.Value = 0; ProgressBar.Visibility = Visibility.Visible; }); //监听取消下载: DetailDownLoad.CancelEvent += (s, e) => { Dispatcher.Invoke((Action) delegate() { ProgressBar.Visibility = Visibility.Hidden; }); }; //更新 UI DetailDownLoad.InfoUpdate += (s, e) => { Dispatcher.Invoke((Action) delegate() { DetailMovieEventArgs eventArgs = e as DetailMovieEventArgs; ProgressBar.Value = (eventArgs.value / eventArgs.maximum) * 100; ProgressBar.Visibility = Visibility.Visible; if (ProgressBar.Value == ProgressBar.Maximum) { ProgressBar.Visibility = Visibility.Hidden; } //判断是否是当前番号 if (vieModel.DetailMovie.id.ToUpper() == eventArgs.DetailMovie.id.ToUpper()) { vieModel.Query(eventArgs.DetailMovie.id); } }); }; }
public WindowDetails(string movieid = "") { //movieid = "IPX-163"; InitializeComponent(); if (movieid != "") { vieModel = new VieModel_Details(); vieModel.Query(movieid); this.DataContext = vieModel; } else { this.DataContext = null; } AdjustWindow(); FatherGrid.Focus(); SetSkin(); }