示例#1
0
 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);
     }
 }
示例#2
0
        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;
     }
 }
示例#4
0
        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();
            }
        }
示例#5
0
 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);
     }
 }
示例#6
0
 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;
 }
示例#7
0
 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);
 }
示例#8
0
 private ISpiderStatus GetSpiderStatus(Core.Spider spider, MonitorSpiderListener monitorSpiderListener)
 {
     return(new SpiderStatus(spider, monitorSpiderListener));
 }
示例#9
0
 private ISpiderStatus GetSpiderStatus(Core.Spider spider, MonitorSpiderListener monitorSpiderListener)
 {
     return new SpiderStatus(spider, monitorSpiderListener);
 }