예제 #1
0
        public AuthCertificateUpdater(IScheduler scheduler,
                                      Common.Configuration.Config appConfig,
                                      IAuthCertificateManager authCertificateManager)
        {
            _appConfig = appConfig;
            _authCertificateManager = authCertificateManager;

            _timer       = scheduler.Timer();
            _timer.Tick += Timer_OnTick;
        }
예제 #2
0
 public StreamingServicesUpdater(
     StreamingServicesStorage streamingServicesStorage,
     IApiClient apiClient,
     IScheduler scheduler,
     Common.Configuration.Config config)
 {
     _streamingServicesStorage = streamingServicesStorage;
     _apiClient      = apiClient;
     _timer          = scheduler.Timer();
     _timer.Interval = config.StreamingServicesUpdateInterval.RandomizedWithDeviation(0.2);
     _timer.Tick    += Timer_OnTick;
     _updateAction   = new SingleAction(UpdateStreamingServices);
 }
예제 #3
0
 public ClientConfig(
     IAppSettings appSettings,
     IScheduler scheduler,
     IApiClient apiClient,
     Common.Configuration.Config config)
 {
     _appSettings    = appSettings;
     _apiClient      = apiClient;
     _timer          = scheduler.Timer();
     _timer.Interval = config.ClientConfigUpdateInterval.RandomizedWithDeviation(0.2);
     _timer.Tick    += Timer_OnTick;
     _updateAction   = new SingleAction(UpdateAction);
 }
예제 #4
0
 public AnnouncementService(
     IAppSettings appSettings,
     IScheduler scheduler,
     IApiClient apiClient,
     IAnnouncementCache announcementCache,
     TimeSpan updateInterval)
 {
     _appSettings       = appSettings;
     _announcementCache = announcementCache;
     _apiClient         = apiClient;
     _timer             = scheduler.Timer();
     _timer.Interval    = updateInterval.RandomizedWithDeviation(0.2);
     _timer.Tick       += Timer_OnTick;
     _updateAction      = new SingleAction(Fetch);
 }
예제 #5
0
        public ServerUpdater(
            IScheduler scheduler,
            Config appConfig,
            ServerManager serverManager,
            ApiServers apiServers,
            ICollectionStorage <LogicalServerContract> serverCache)
        {
            _serverManager = serverManager;
            _apiServers    = apiServers;
            _serverCache   = serverCache;

            _timer          = scheduler.Timer();
            _timer.Interval = appConfig.ServerUpdateInterval.RandomizedWithDeviation(0.2);
            _timer.Tick    += Timer_OnTick;

            _updateAction = new SingleAction(UpdateServers);
        }
예제 #6
0
        public ServersUpdater(
            ILogger logger,
            IScheduler scheduler,
            Config appConfig,
            ServerManager serverManager,
            CachedServersProvider serversProvider)
        {
            _logger          = logger;
            _serverManager   = serverManager;
            _serversProvider = serversProvider;

            _timer          = scheduler.Timer();
            _timer.Interval = appConfig.ServerUpdateInterval.RandomizedWithDeviation(0.2);
            _timer.Tick    += Timer_OnTick;

            _updateAction = new SingleAction(UpdateServers);
        }
예제 #7
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();
        }
예제 #8
0
        public void TestInitialize()
        {
            _logger           = Substitute.For <ILogger>();
            _appConfig        = new Common.Configuration.Config();
            _blockedTraffic   = Substitute.For <IBlockedTraffic>();
            _forwardedTraffic = Substitute.For <IForwardedTraffic>();
            _scheduler        = Substitute.For <IScheduler>();
            _modals           = Substitute.For <IModals>();
            _dialogs          = Substitute.For <IDialogs>();

            _timer = Substitute.For <ISchedulerTimer>();
            _timer.When(x => x.Start()).Do(x => _timerIsEnabled = true);
            _timer.When(x => x.Stop()).Do(x => _timerIsEnabled  = false);
            _timer.When(x => x.IsEnabled = Arg.Do <bool>(value => _timerIsEnabled = value));
            _timer.IsEnabled.Returns(_ => _timerIsEnabled);
            _scheduler.Timer().Returns(_timer);
        }
예제 #9
0
        public ReconnectManager(
            IVpnConfig config,
            IApiClient apiClient,
            ProfileManager profileManager,
            ServerManager serverManager,
            IVpnManager vpnManager,
            IScheduler scheduler,
            IServerUpdater serverUpdater)
        {
            _config         = config;
            _serverUpdater  = serverUpdater;
            _serverManager  = serverManager;
            _vpnManager     = vpnManager;
            _profileManager = profileManager;
            _apiClient      = apiClient;

            _timer       = scheduler.Timer();
            _timer.Tick += OnTimerTick;
        }
예제 #10
0
        public ReconnectManager(
            IAppSettings appSettings,
            IApiClient apiClient,
            ProfileManager profileManager,
            ServerManager serverManager,
            IVpnManager vpnManager,
            IScheduler scheduler,
            IServerUpdater serverUpdater)
        {
            _appSettings    = appSettings;
            _serverUpdater  = serverUpdater;
            _serverManager  = serverManager;
            _vpnManager     = vpnManager;
            _profileManager = profileManager;
            _apiClient      = apiClient;

            _timer       = scheduler.Timer();
            _timer.Tick += OnTimerTick;
        }
예제 #11
0
        private P2PDetector(
            ILogger logger,
            IBlockedTraffic blockedTraffic,
            IForwardedTraffic forwardedTraffic,
            ISchedulerTimer timer,
            IModals modals,
            IDialogs dialogs,
            TimeSpan checkInterval)
        {
            _logger           = logger;
            _blockedTraffic   = blockedTraffic;
            _forwardedTraffic = forwardedTraffic;
            _timer            = timer;
            _modals           = modals;
            _dialogs          = dialogs;

            _timer.Interval = checkInterval;
            _timer.Tick    += OnTimerTick;
        }
예제 #12
0
        public ServerUpdater(
            IScheduler scheduler,
            Common.Configuration.Config appConfig,
            ServerManager serverManager,
            IApiServers apiServers,
            ICollectionStorage <LogicalServerContract> serverCache,
            ServerLoadUpdater serverLoadUpdater,
            IAppSettings appSettings)
        {
            _serverManager = serverManager;
            _apiServers    = apiServers;
            _serverCache   = serverCache;
            _appSettings   = appSettings;

            _timer          = scheduler.Timer();
            _timer.Interval = appConfig.ServerUpdateInterval.RandomizedWithDeviation(0.2);
            _timer.Tick    += Timer_OnTick;

            _updateAction = new SingleAction(UpdateServers);
            serverLoadUpdater.ServerLoadsUpdated += OnServerLoadsUpdated;
        }
예제 #13
0
        public ServerLoadUpdater(
            TimeSpan updateInterval,
            ServerManager serverManager,
            IScheduler scheduler,
            IEventAggregator eventAggregator,
            IMainWindowState mainWindowState,
            IApiServers apiServers,
            ISingleActionFactory singleActionFactory,
            ILastServerLoadTimeProvider lastServerLoadTimeProvider)
        {
            _lastServerLoadTimeProvider = lastServerLoadTimeProvider;
            eventAggregator.Subscribe(this);

            _updateInterval  = updateInterval;
            _mainWindowState = mainWindowState;
            _serverManager   = serverManager;
            _apiServers      = apiServers;
            _timer           = scheduler.Timer();
            _timer.Interval  = updateInterval.RandomizedWithDeviation(0.2);
            _timer.Tick     += TimerOnTick;
            _updateAction    = singleActionFactory.GetSingleAction(UpdateLoads);
        }