Exemple #1
0
        private void RefreshSchedule()
        {
            var info = CrawlerManager.CrawlerFactory.Info;

            SJobCntLbl.Text    = info.JobCount.ToString();
            SCrawlCntLbl.Text  = info.ItemCount.ToString();
            SErrorCntLbl.Text  = info.ErrorCount.ToString();
            SStartTimeLbl.Text = info.StartTime.ToString();
            if (CrawlerManager.CrawlerFactory.Trigger_SchedulerInfoChange == null)
            {
                CrawlerManager.CrawlerFactory.Trigger_SchedulerInfoChange =
                    new Scheduler.del_MsgSender(
                        msg =>
                {
                    IPipeMessage message = new IPipeMessage();
                    message.Message      = msg;
                    message.GenerateTime = DateTime.Now;
                    lock (_scheduleSync)
                    {
                        _currentScheduleMessage.Add(message);
                        if (_currentScheduleMessage.Count > 20)
                        {
                            _currentScheduleMessage.RemoveAt(0);
                        }
                    }
                });
            }

            var selStart  = SContentTxt.SelectionStart;
            var selLength = SContentTxt.SelectionLength;
            var point     = SContentTxt.AutoScrollOffset;

            SContentTxt.Text = "";
            string[] result;
            lock (_scheduleSync)
            {
                result = (from item in _currentScheduleMessage
                          select string.Format("[{1}]{0}", item.Message,
                                               item.GenerateTime.ToString("HH:mm"))).Reverse().ToArray();
            }
            SContentTxt.Lines = result;
            try
            {
                SContentTxt.SelectionStart   = selStart;
                SContentTxt.SelectionLength  = selLength;
                SContentTxt.AutoScrollOffset = point;
            }
            catch { }
        }
Exemple #2
0
        private void RefreshMessage()
        {
            var pipeLines = CrawlerManager.CrawlerFactory.Pipelines;

            foreach (var item in pipeLines)
            {
                if (!_pipelineDic.ContainsKey(item.Info.Name))
                {
                    _pipelineDic[item.Info.Name] = new List <IPipeMessage>();
                }

                if (item.Info.Trigger_PipelineInfoChange == null)
                {
                    IPipeline item1 = item;
                    item.Info.Trigger_PipelineInfoChange = new Scheduler.del_MsgSender(msg =>
                    {
                        var messageList      = _pipelineDic[item1.Info.Name];
                        IPipeMessage message = new IPipeMessage();
                        message.Message      = msg;
                        message.GenerateTime = DateTime.Now;
                        lock (sync)
                        {
                            messageList.Add(message);
                        }

                        if (messageList.Count > 20)
                        {
                            lock (sync)
                            {
                                messageList.RemoveAt(0);
                            }
                        }
                    });
                }
            }
        }