Пример #1
0
        public void GetImagesList(object b)//获取批量图片
        {
            var                    count    = 0;
            var                    comicDic = new Dictionary <string, string>();
            Image                  image    = null;
            ViewStruct             view     = (ViewStruct)b;
            Queue <BasicComicInfo> queue    = view.Queue;
            ProcessbarDelegate     progress = new ProcessbarDelegate(AddProgress);
            AddListViewItem        addItem  = new AddListViewItem(ListViewItemAdd);
            ListViewItem           item     = null;

            lock (objLock)
            {
                this.Invoke(new Action(() =>
                {
                    m_exitLoad = false;
                    resultListView.Items.Clear();
                    showImageList.Images.Clear();
                    view.ViewAdd.LargeImageList = showImageList;
                }));

                foreach (var i in queue)
                {
                    if (m_exitLoad == false)
                    {
                        progressBar1.Invoke(progress, progressBar1);
                        image           = AnalyseTool.GetImage(i.ComicImgUrl);
                        item            = new ListViewItem();
                        item.Text       = i.ComicName;
                        item.ImageIndex = count++;
                        // Console.WriteLine("漫画名字:{0},图片索引:{1}", item.Text, item.ImageIndex);
                        this.Invoke(addItem, item, image, view.ViewAdd);

                        if (comicDic.ContainsKey(i.ComicName) == false)
                        {
                            comicDic.Add(i.ComicName, i.ComicHref);
                        }

                        resourse.SearchResultURL = comicDic;
                    }
                    else
                    {
                        count      = 0;
                        m_exitLoad = true;
                        return;
                    }
                }

                m_exitLoad = true;
                runGif.Invoke(new Action(() =>
                {
                    runGif.Visible = false;
                }));
            }
        }
Пример #2
0
        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();
            }
        }