Пример #1
0
        public MailSenderService()
        {
            InitializeComponent();

            _connectionString = ConfigurationManager.ConnectionStrings[0].ConnectionString;
            _smtp = CreateSmtpClient();
            _config = MailSenderConfiguration.GetConfiguration();
            _timer = SetupTimerFromConfig(_config);
            _currentLimit = new Limit
            {
                LastTime = DateTime.MinValue,
                CurrentQuantity = 0
            };
        }
Пример #2
0
        private Timer SetupTimerFromConfig(MailSenderConfigurationSection config)
        {
            var timer = new Timer
            {
                Interval = config.CheckTimer.Interval.TotalMilliseconds,
                AutoReset = false
            };

            timer.Elapsed += timer_Elapsed;

            return timer;
        }