public void Dispose() { pollingTimer?.Stop(); pollingTimer = null; gocdService?.Dispose(); gocdService = null; }
public void Restart() { pollingTimer?.Stop(); gocdService?.Dispose(); var connectionInfo = GetConnectionInfo(); gocdService = gocdServiceFactory.Create(connectionInfo); PollAndUpdate(); // timer does not cause re-entry pollingTimer = new DispatcherTimer(TimeSpan.FromSeconds(connectionInfo.PollingIntervalSeconds), DispatcherPriority.Normal, (sender, args) => PollAndUpdate(), Dispatcher.CurrentDispatcher); }
public ServiceManager(IGocdServiceFactory gocdServiceFactory) { this.gocdServiceFactory = gocdServiceFactory; this.gocdService = gocdServiceFactory.Create(GetConnectionInfo()); }