private void collectBtn_Click(object sender, EventArgs e) { var count = 0; Image image; SqlOperate opt = new SqlOperate(); FileStream stream; ListViewItemInfo item = null; var list = opt.GetCollet(); showImageList.Images.Clear(); resultListView.Items.Clear(); mainFrame.SelectedPageIndex = 0; m_exitLoad = true; foreach (var i in list) { stream = new FileStream(i.ImagePath, FileMode.Open, FileAccess.Read); item = new ListViewItemInfo(); item.Text = i.Name; item.ImageIndex = count++; item.ReferUrl = i.Href; image = Image.FromStream(stream); item.ConverImg = image; showImageList.Images.Add(image); resultListView.Items.Add(item); stream.Close(); } resultListView.LargeImageList = showImageList; }
private void ListViewItemAdd(ListViewItemInfo item, Image image, ListView addView) { if (image != null && !m_exitLoad) { showImageList.Images.Add(image); addView.Items.Add(item); } }
private void downnLoadTool_Click(object sender, EventArgs e)//下载漫画 { try { string savaPath = ""; DownLoadFile downFile; List <DownLoadFile> downFileList; downFileList = new List <DownLoadFile>(); ListViewItemInfo item = currentItem as ListViewItemInfo; if (downForm == null) { downForm = new DownLoadForm(); } if (File.Exists("CONFIG.INI")) { savaPath = ComicConfig.ReadConfig("savePath"); } else { savaPath = ".\\"; } foreach (Controls.CheckBoxEx i in checkPanel.Controls) { if (i.Checked) { if (item.UrlDictronary.ContainsKey(i.FullText)) { downFile = new DownLoadFile(); downFile.ComicUrl = item.UrlDictronary[i.FullText]; downFile.ComicName = comicNameLabel.Text.Substring(4) + i.Text; downFile.SavePath = savaPath; downFileList.Add(downFile); } } } downForm.StartPosition = FormStartPosition.Manual; downForm.Location = new Point(this.Left + 55, this.Bottom - downForm.Height - 50); downForm.Start(downFileList, decoder); downForm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void GetImagesList(object b)//获取批量图片 { var count = 0; Image image = null; ViewStruct view = (ViewStruct)b; Queue <BasicComicInfo> queue = view.Queue; ProcessbarDelegate progress = new ProcessbarDelegate(AddProgress); AddListViewItem addItem = new AddListViewItem(ListViewItemAdd); ListViewItemInfo item = null; lock (getLock) { this.Invoke(new Action(() => { m_exitLoad = false; resultListView.Items.Clear(); showImageList.Images.Clear(); view.ViewAdd.LargeImageList = showImageList; })); DateTime time = DateTime.Now; foreach (var i in queue) { if (m_exitLoad == false) { progressBar1.Invoke(progress, progressBar1); image = AnalyseTool.GetImage(i.ComicImgUrl); item = new ListViewItemInfo(); item.Text = i.ComicName; item.ImageIndex = count++; item.ReferUrl = i.ComicHref; this.Invoke(addItem, item, image, view.ViewAdd); } else { count = 0; m_exitLoad = true; SetGifHidden(); return; } } m_exitLoad = true; SetGifHidden(); } }
private void startReadBtn_Click(object sender, EventArgs e) { DownLoadFile downFile = null; DownTask downTask; ComicReader reader = new ComicReader(); reader.readFinishedEvent += Reader_readFinishedEvent; ListViewItemInfo item = currentItem as ListViewItemInfo; foreach (Controls.CheckBoxEx i in checkPanel.Controls) { if (i.Checked) { if (item.UrlDictronary.ContainsKey(i.FullText)) { downFile = new DownLoadFile(); downFile.ComicUrl = item.UrlDictronary[i.FullText]; downFile.ComicName = comicNameLabel.Text.Substring(4) + i.Text; downFile.SavePath = "temp\\"; break; } } } if (downFile == null) { return; } downTask = new DownTask(); downTask.addFileEvent += reader.AddFileToList; downTask.ComicName = downFile.ComicName; downTask.DownLoadPath = downFile.SavePath; downTask.SourceUrl = downFile.ComicUrl; downTask.GetNetComic(downFile); reader.StartRead(); reader.Show(); }
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(); })); }