public SpiderMonitor Register(params Core.Spider[] spiders) { lock (this) { foreach (Core.Spider spider in spiders) { if (!_data.ContainsKey(spider)) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(spider); _data.Add(spider, monitorSpiderListener); } } return(this); } }
private void Register(Core.Spider spider, ISpiderStatus spiderStatus, MonitorSpiderListener monitorSpiderListener) { if (spider.ShowControl) { Form1 form1 = new Form1(spiderStatus); form1.ShowDialog(); } if (spider.SaveStatusInRedis) { RedisStatusUpdater statusUpdater = new RedisStatusUpdater(spider, spiderStatus); monitorSpiderListener.ClosingEvent += statusUpdater.UpdateStatus; statusUpdater.Run(); } }
public SpiderMonitor Register(params Core.Spider[] spiders) { lock (this) { foreach (Core.Spider spider in spiders) { if (!_data.ContainsKey(spider)) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(spider); _data.Add(spider, monitorSpiderListener); } } return this; } }
public SpiderMonitor Register(params Core.Spider[] spiders) { lock (this) { foreach (Core.Spider spider in spiders) { if (!_data.ContainsKey(spider)) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(spider); spider.RequestFailedEvent += monitorSpiderListener.OnError; spider.RequestSuccessedEvent += monitorSpiderListener.OnSuccess; spider.SpiderClosingEvent += monitorSpiderListener.OnClose; _data.Add(spider, monitorSpiderListener); } } return(this); } }
public SpiderMonitor Register(params Core.Spider[] spiders) { foreach (Core.Spider spider in spiders) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(); if (spider.GetSpiderListeners() == null) { List<ISpiderListener> spiderListeners = new List<ISpiderListener> { monitorSpiderListener }; spider.SetSpiderListeners(spiderListeners); } else { spider.GetSpiderListeners().Add(monitorSpiderListener); } ISpiderStatus spiderStatus = GetSpiderStatus(spider, monitorSpiderListener); Register(spider, spiderStatus, monitorSpiderListener); } return this; }
public SpiderMonitor Register(params Core.Spider[] spiders) { foreach (Core.Spider spider in spiders) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(); if (spider.GetSpiderListeners() == null) { List <ISpiderListener> spiderListeners = new List <ISpiderListener> { monitorSpiderListener }; spider.SetSpiderListeners(spiderListeners); } else { spider.GetSpiderListeners().Add(monitorSpiderListener); } ISpiderStatus spiderStatus = GetSpiderStatus(spider, monitorSpiderListener); Register(spider, spiderStatus, monitorSpiderListener); } return(this); }
private ISpiderStatus GetSpiderStatus(Core.Spider spider, MonitorSpiderListener monitorSpiderListener) { return(new SpiderStatus(spider, monitorSpiderListener)); }
private ISpiderStatus GetSpiderStatus(Core.Spider spider, MonitorSpiderListener monitorSpiderListener) { return new SpiderStatus(spider, monitorSpiderListener); }