private void DataCollectingTimerCallback(object obj) { try { _configManager.CheckConfig(_config); ConfigModel config = (ConfigModel)obj; var cameras = _cameraManager.GetCameraListAsync().Result; foreach (var cam in cameras) { try { _dataManager.CollectDataAsync(config, cam).Wait(); _logger.Info($"Get data from IP {cam.IpAddress} is successful."); } catch (AggregateException ex) { var errorMessage = ex.InnerException.Message; _logger.Error($"Cannot get data from IP {cam.IpAddress}: {errorMessage}"); } } } catch (Exception ex) { _logger.Error(ex.Message); } }