示例#1
0
        protected BaseWorker(MailBoxManager mailBoxManager, MailBox mailBox, TasksConfig tasksConfig,
                             CancellationToken cancelToken, ILogger log = null)
        {
            this.mailBoxManager = mailBoxManager;
            _mailBox = mailBox;
            this.log = log ?? new NullLogger();
            _lastTimeItemChecked = DateTime.UtcNow;
            _maxMessagesPerSession = tasksConfig.MaxMessagesPerSession;
            this.tasksConfig = tasksConfig;
            _signalrServiceClient = new SignalrServiceClient();

            _needSignal = false;

            this.cancelToken = cancelToken;

            if (tasksConfig.ShowActiveUpLogs)
            {
                Logger.Log4NetLogger = log4net.LogManager.GetLogger(string.Format("Task_{0}->ActiveUp", Task.CurrentId));
                Logger.Disabled = false;
            }
            else
            {
                Logger.Log4NetLogger = null;
                Logger.Disabled = true;
            }
        }
示例#2
0
        private const string EMPTY_HTML_BODY = "<div dir=\"ltr\"><br></div>"; // GMail style

        public MailSendQueue(MailBoxManager manager, ILogger log)
        {
            this.manager = manager;
            this.log = log;
            if (_signalrServiceClient != null) return;
            var enableSignalr = string.IsNullOrEmpty(ConfigurationManager.AppSettings["web.hub"]) ? "false" : "true";
            _signalrServiceClient = new SignalrServiceClient(enableSignalr);
        }