private void FillComicInfo(ListView selectView) { var receive = ""; var url = ""; if (selectView.SelectedItems == null) { return; } ListViewItemInfo item = null; this.Invoke(new Action(() => { item = selectView.SelectedItems[0] as ListViewItemInfo; mainFrame.SelectedPageIndex = 1; comicNameLabel.Text = "漫画名:" + item.Text; comicPicBox.Image = showImageList.Images[selectView.SelectedItems[0].Index]; url = item.ReferUrl; resource.ComicName = item.Text; resource.ComicHref = url; currentItem = item; })); //ShowWait(checkPanel); decoder = DecoderDistrution.GiveDecoder(url); receive = AnalyseTool.HttpGet(url); //RemoveWait(checkPanel); if (receive == "") { MessageBox.Show("网络错误,获取失败"); return; } var comicInfo = decoder.GetComicInfo(receive); item.UrlDictronary = comicInfo.URLDictionary; this.Invoke(new Action(() => { authorLab.Text = (comicInfo.Author == null || comicInfo.Author.Length == 0) ? "略" : comicInfo.Author; tagLabe.Text = "标签: " + comicInfo.Tag; descLable.Text = "简介:" + comicInfo.Description; statusLab.Text = "连载状态:" + comicInfo.HasFinished; checkPanel.Controls.Clear(); if (comicInfo.URLDictionary == null) { descLable.Text = "简介:" + "该漫画已经下架!"; return; } List <Controls.CheckBoxEx> list = new List <Controls.CheckBoxEx>(); foreach (var i in comicInfo.URLDictionary) { var checkBox = new Controls.CheckBoxEx(); checkBox.Text = i.Key; list.Add(checkBox); } checkPanel.Controls.AddRange(list.ToArray()); SetGifHidden(); })); }
private void FillComicInfo(ListView selectView) { int x = 0; int y = 0; var receive = ""; mainFrame.SelectedPageIndex = 1; comicNameLabel.Text = "漫画名:" + selectView.SelectedItems[0].Text; var url = resourse.SearchResultURL[selectView.SelectedItems[0].Text]; resourse.ComicName = selectView.SelectedItems[0].Text; resourse.ComicHref = url; decoder = DecoderDistrution.GiveDecoder(url); receive = AnalyseTool.HttpGet(url); if (receive == "") { MessageBox.Show("网络错误,获取失败"); return; } var comicInfo = decoder.GetComicInfo(receive); downUrlDic = new Dictionary <string, string>();//存储当前漫画所有图片链接 downUrlDic = comicInfo.URLDictionary; comicPicBox.Image = showImageList.Images[selectView.SelectedItems[0].Index]; authorLab.Text = (comicInfo.Author == null || comicInfo.Author.Length == 0)? "略":comicInfo.Author; tagLabe.Text = "标签: " + comicInfo.Tag; descLable.Text = "简介:" + comicInfo.Description; statusLab.Text = "连载状态:" + comicInfo.HasFinished; CheckBox check; checkPanel.Controls.Clear(); Task task = new Task(() => { foreach (var i in comicInfo.URLDictionary) { check = new CheckBox(); check.AutoSize = true; check.Text = i.Key; check.Location = new Point(x, y); this.Invoke(new Action(() => { checkPanel.Controls.Add(check); })); if (x + check.Width + 5 > checkPanel.Width - check.Width - 10)//如果 { x = 0; y = y + check.Height + 20; } else { x = x + check.Width + 5; } } }); task.Start(); }