private void Crawler_CrawlerStopped(ParallelCrawler obj) { Action action = () => lblInfo.Text = "爬虫已停止"; if (this.InvokeRequired) { this.Invoke(action); } else { action(); } }
private void Crawler_PageDownloaded(ParallelCrawler crawler, int index, string url, string info) { var pageInfo = new { Index = index, URL = url, Status = info }; Action action = () => { BS.Add(pageInfo); }; if (this.InvokeRequired) { this.Invoke(action); } else { action(); } }