Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        private async Task LoadCameraAsync()
        {
            try
            {
                IsLoading = true;

                CameraCollection.Clear();
                var cameras = await _cameraManager.GetCameraListAsync();

                int i = 0;
                foreach (var camera in cameras)
                {
                    var cam = Mapper.Map <CameraViewModel>(camera);
                    cam.RowNumber = ++i;
                    CameraCollection.Add(cam);
                }
            }
            catch (Exception ex)
            {
                _dialogService.ShowMessage(ex.Message, "Error");
            }
            finally
            {
                IsLoading = false;
            }
        }