コード例 #1
0
        public NotifierProcessorDecorator(ANotifierProcessorParams notifierProcessorParams) : base(notifierProcessorParams.NotifierProcessor)
        {
            if (CheckTimeForCloseApp(((NotifierProcessorDecoratorParams)notifierProcessorParams).Lifetime))
            {
                return;
            }
            _dataReader     = ((NotifierProcessorDecoratorParams)notifierProcessorParams).DataReader;
            _clientsManager = notifierProcessorParams.ClientsManager;
            _logger         = notifierProcessorParams.Logger;

            if (((NotifierProcessorDecoratorParams)notifierProcessorParams).Lifetime != DateTime.MinValue)
            {
                _lifetime = ((NotifierProcessorDecoratorParams)notifierProcessorParams).Lifetime;
                _timer    = new Timer(notifierProcessorParams.Interval)
                {
                    AutoReset = true
                };
                _timer.Elapsed += (sender, eventArgs) =>
                {
                    Close();
                };

                _timer.Start();
            }

            Execute();
        }
コード例 #2
0
        public HostFactoryNotifierProcessor(ANotifierProcessorParams notifierProcessorParams)
        {
            _dataReaders                    = (notifierProcessorParams as HostFactoryNotifierProcessorParams)?.DataReaders;
            _clientsManager                 = notifierProcessorParams.ClientsManager;
            _logger                         = notifierProcessorParams.Logger;
            _filtersValidator               = (notifierProcessorParams as HostFactoryNotifierProcessorParams)?.FiltersValidator;
            _filtersValidatorRepository     = (notifierProcessorParams as HostFactoryNotifierProcessorParams)?.FiltersValidatorRepository;
            _aggregatorsValidator           = (notifierProcessorParams as HostFactoryNotifierProcessorParams)?.AggregatorsValidator;
            _aggregatorsValidatorRepository = (notifierProcessorParams as HostFactoryNotifierProcessorParams)?.AggregatorsValidatorRepository;

            _lock = false;

            _timer = new Timer(notifierProcessorParams.Interval)
            {
                AutoReset = true
            };
            _timer.Elapsed += (sender, eventArgs) =>
            {
                ProcessingData();
            };
        }