Exemplo n.º 1
0
        private void InitConfig()
        {
            AddLog("Loading configuration values...");

            _configHandler = new AppConfigHandler();
            _config        = _configHandler.GetConfig();
            _ipChecker     = _config.IPChecker;

            var _amazonClient = new AmazonRoute53Client(_config.Route53AccessKey, _config.Route53SecretKey, RegionEndpoint.USEast1);

            _dnsUpdater = new DnsUpdater(_amazonClient);

            AddLog($"Found {_config.DomainList.Count} domain(s)");
            foreach (HostedDomainInfo domainInfo in _config.DomainList)
            {
                AddLog($"{domainInfo.DomainName}");
            }

            if (_timer != null)
            {
                // Stop to avoid multiple timer_Tick invocations
                _timer.Stop();
            }

            int interval = _config.UpdateInterval;

            _timer          = new System.Windows.Threading.DispatcherTimer();
            _timer.Tick    += timer_Tick;
            _timer.Interval = new TimeSpan(0, 0, interval);
            _timer.Start();

            AddLog($"Time set to update domains every {interval} seconds");

            SetAutoStart();
        }
Exemplo n.º 2
0
 public ScheduledTaskWorker(IDnsUpdater dnsUpdater, IIPCheckerStrategy ipChecker, IEnumerable <HostedDomainInfo> domainList)
 {
     this.dnsUpdater = dnsUpdater;
     this.ipChecker  = ipChecker;
     this.domainList = domainList;
 }