Example #1
0
        public Task OnVpnStateChanged(VpnStateChangedEventArgs e)
        {
            if (!_config.MaintenanceTrackerEnabled)
            {
                return(Task.CompletedTask);
            }

            _state = e.State;

            if (e.State.Status == VpnStatus.Connected)
            {
                if (!_timer.IsEnabled)
                {
                    _timer.Interval = _config.MaintenanceCheckInterval;
                    _timer.Start();
                }
            }
            else
            {
                if (_timer.IsEnabled)
                {
                    _timer.Stop();
                }
            }

            return(Task.CompletedTask);
        }
Example #2
0
 private void StartTimer()
 {
     if (!_timer.IsEnabled)
     {
         _timer.Start();
     }
 }
Example #3
0
        public VpnInfoChecker(Common.Configuration.Config appConfig,
                              IEventAggregator eventAggregator,
                              IApiClient api,
                              IUserStorage userStorage,
                              IScheduler scheduler)
        {
            eventAggregator.Subscribe(this);

            _checkInterval = appConfig.VpnInfoCheckInterval.RandomizedWithDeviation(0.2);
            _api           = api;
            _userStorage   = userStorage;

            _timer          = scheduler.Timer();
            _timer.Interval = appConfig.ServerUpdateInterval.RandomizedWithDeviation(0.2);
            _timer.Tick    += OnTimerTick;
            _timer.Start();
        }
Example #4
0
 public void OnUserLoggedIn()
 {
     _timer.Start();
 }
Example #5
0
 public void OnUserLoggedIn()
 {
     _timer.Interval = _appConfig.AuthCertificateUpdateInterval.RandomizedWithDeviation(0.2);
     _timer.Start();
 }
Example #6
0
 public void OnUserLoggedIn()
 {
     _timer.Start();
     _lastVpnProtocol = _appSettings.GetProtocol();
 }