Exemplo n.º 1
0
        private void doDataLiftWork()
        {
            try
            {
                _log.Debug("+doDataLiftWork()");
                this._registry = new LocalRegistryService();
                if (this._registry.isRegistry())
                {
                    if (this.isGreaterThanADay(_registry.getLastRunDateFromRegistry()) || this._registry.getRunNowBooleanFromRegistry())
                    {
                        this._readingDao = new ReadingDao();
                        this._deviceDao  = new DeviceDao();
                        this._run        = new ScheduledRun(this._registry, this._readingDao, this._deviceDao);
                        this._run.getDataAndPostToWebService();

                        //After use, set date to now and run now to false
                        this._registry.setRegistryValueLastRunDateToNow();
                        this._registry.setRegistryValueRunNowBoolean();
                    }
                }
                else
                {
                    this._registry.CreateRegistryPathAndAllValues();
                }
                _log.Debug("-doDataLiftWork()");
            }
            catch (Exception ex)
            {
                _log.Error("-doDataLiftWork() Message: " + ex.Message + " InnerException: " + ex.InnerException);
            }
        }
Exemplo n.º 2
0
 public ScheduledRun(LocalRegistryService registry, IReadingDao readingDao, IDeviceDao deviceDao)
 {
     _log.Debug("+ScheduledRun()");
     this._registry   = registry;
     this._readingDao = readingDao;
     this._deviceDao  = deviceDao;
     _log.Debug("-ScheduledRun()");
 }
Exemplo n.º 3
0
 //Poll interval key from the registry to set the timer
 private void setInterval()
 {
     _log.Debug("+setInterval()");
     this._registry = new LocalRegistryService();
     if (this._registry.isRegistry())
     {
         Int32.TryParse(this._registry.getTimePollIntervalFromRegistry(), out _interval);
         _timer.Interval = _interval;
     }
     else
     {
         _interval = 60000; //60000 = 60 seconds, 900000 = 15 minutes
     }
     _log.Debug("-setInterval()");
 }
Exemplo n.º 4
0
 private void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     try
     {
         _log.Debug("+TimerElapsed()");
         _timer.Stop();
         this.doDataLiftWork();
         this._registry = new LocalRegistryService();
         this.setInterval();
         _timer.Start();
         _log.Debug("-TimerElapsed()");
     }
     catch (Exception ex)
     {
         _log.Error("-TimerElapsed() Message: " + ex.Message + " InnerException: " + ex.InnerException);
     }
 }