コード例 #1
0
        private void Crawler_CrawlerStopped(MyCrawler obj)
        {
            Action action = () => labelStart.Text = "爬虫已停止";

            if (this.InvokeRequired)
            {
                this.Invoke(action);
            }
            else
            {
                action();
            }
        }
コード例 #2
0
        private void Crawler_PageDownloaded(MyCrawler crawler, string url, string info)
        {
            var    pageInfo = new { Index = resultBindingSource.Count + 1, URL = url, Status = info };
            Action action   = () => { resultBindingSource.Add(pageInfo); };

            if (this.InvokeRequired)
            {
                this.Invoke(action);
            }
            else
            {
                action();
            }
        }