void OneThreadProducer(string url) { int threadName = Int32.Parse(Thread.CurrentThread.Name); if (!urlsForCheck.ContainsKey(url)) { CrawlOneUrlProducer(url); } if (!dicitonaryOfCrawledUrls.IsEmpty) { if (threadName % 2 == 0) { CrawlInternalUrls(dicitonaryOfCrawledUrls.ElementAt(0).Value); } CrawlExternalUrls(dicitonaryOfCrawledUrls.ElementAt(0).Value); } while (!dicitonaryOfCrawledUrls.IsEmpty) { if (cancelTicket) { break; } if (dicitonaryOfCrawledUrls.Count <= threadName) { continue; } var temp = dicitonaryOfCrawledUrls.ElementAtOrDefault(threadName); if (temp.Value != null) { CrawlUrls(temp.Value); } } logger.Trace("Thread " + Thread.CurrentThread.Name + " finish"); }
private static void closeAllPopups(Popup popup = null) { for (var i = opened_popups.Count - 1; i >= 0; i--) { var p = opened_popups.ElementAtOrDefault(i); if (p.Value == null || !p.Value.IsOpen) { continue; } var pc = p.Value.Tag as PopupContainer; if (popup != null && !Equals(popup, p.Value)) { continue; } if (pc != null && pc.IsChildrenExists) { continue; } p.Value.IsOpen = false; } }