public override void Initialize() { _imageProcessor.TimerElapsed += ImageProcessorOnTimerElapsed; _imageProcessor.CameraErrorEvent += ImageProcessorOnCameraErrorEvent; _imageProcessor.ImageChanged += ImageProcessorOnStreamChanged; _imageProcessor.ImageNumberChanged += ImageProcessorOnImageNumberChanged; _imageProcessor.InitializeProcessor(); OpenSession(); if (!_sessionOpened) { return; } _settings = _settingsProvider.GetCameraSettings(); if (_settings != null) { _imageProcessor.SetSetting((uint)PropertyId.AEMode, (uint)_settings.SelectedAeMode); _imageProcessor.SetSetting((uint)PropertyId.WhiteBalance, (uint)_settings.SelectedWhiteBalance); _imageProcessor.SetSetting((uint)PropertyId.Av, (uint)_settings.SelectedAvValue); _imageProcessor.SetSetting((uint)PropertyId.ExposureCompensation, (uint)_settings.SelectedCompensation); _imageProcessor.SetSetting((uint)PropertyId.ISOSpeed, (uint)_settings.SelectedIsoSensitivity); _imageProcessor.SetSetting((uint)PropertyId.Tv, (uint)_settings.SelectedShutterSpeed); } _cameraStreamSynchronize = new AutoResetEvent(false); StartLiveView(); }
public override void Initialize() { _logger.Trace("Инициализация"); _imageProcessor.TimerElapsed += ImageProcessorOnTimerElapsed; _imageProcessor.CameraErrorEvent += ImageProcessorOnCameraErrorEvent; _imageProcessor.ImageChanged += ImageProcessorOnStreamChanged; _imageProcessor.ImageNumberChanged += ImageProcessorOnImageNumberChanged; Capturing = false; _imageProcessor.InitializeProcessor(); OpenSession(); if (!_sessionOpened) { _dialogService.ShowInfo("Камера не готова, попробуйте ещё раз."); _logger.Trace("Неудачная поптыка открытия сессии"); return; } _settings = _settingsProvider.GetCameraSettings(); if (_settings != null) { _logger.Trace("Применение настроек для камеры"); //_imageProcessor.SetSetting((uint)PropertyId.AEMode, (uint)_settings.SelectedAeMode); TODO Не поддерживается. _imageProcessor.SetSetting((uint)PropertyId.WhiteBalance, (uint)_settings.SelectedWhiteBalance); _imageProcessor.SetSetting((uint)PropertyId.Av, (uint)_settings.SelectedAvValue); _imageProcessor.SetSetting((uint)PropertyId.ExposureCompensation, (uint)_settings.SelectedCompensation); _imageProcessor.SetSetting((uint)PropertyId.ISOSpeed, (uint)_settings.SelectedIsoSensitivity); _imageProcessor.SetSetting((uint)PropertyId.Tv, (uint)_settings.SelectedShutterSpeed); } _cameraStreamSynchronize = new AutoResetEvent(false); _logger.Trace("Запуск LiveView"); StartLiveView(); var cancellTokenSource = new CancellationTokenSource(); if (TakePictureCommand.CanExecute(cancellTokenSource.Token)) { try { TakePictureCommand.Execute(cancellTokenSource.Token); } catch (Exception ex) { //_dialogService.ShowInfo("Упс... С камерой возникли неполадки. Приносим свои извинения. =("); _logger.Error(ex, "Ошибка при инициализации камеры"); GoBack(); } } else { //_dialogService.ShowInfo("Упс... С камерой возникли неполадки. Приносим свои извинения. =("); _logger.Trace("TakePictureCommand.CanExecute вернул false"); GoBack(); } }
public override void Initialize() { _cameraSettings = new CameraSettingsViewModel(_imageProcessor, _settingsProvider); _imageProcessor.CameraErrorEvent += ImageProcessorOnCameraErrorEvent; _imageProcessor.ImageChanged += ImageProcessorOnStreamChanged; _imageProcessor.CameraAddEvent += ImageProcessorCameraAddEvent; _imageProcessor.CameraRemoveEvent += ImageProcessorCameraRemoveEvent; _imageProcessor.InitializeProcessor(); _cameraStreamSynchronize = new AutoResetEvent(false); TestPhotoTimeEllapsed = 0; CommandManager.InvalidateRequerySuggested(); OpenSession(); _takePhotoEnable = PreviewReady; if (!_sessionOpened) { return; } StartLiveView(); CameraSettings.ClearChanges(); }
public override void Initialize() { _imageProcessor.TimerElapsed += ImageProcessorOnTimerElapsed; _imageProcessor.CameraErrorEvent += ImageProcessorOnCameraErrorEvent; _imageProcessor.ImageChanged += ImageProcessorOnStreamChanged; _imageProcessor.ImageNumberChanged += ImageProcessorOnImageNumberChanged; _imageProcessor.CameraAddEvent += ImageProcessorCameraAddEvent; _imageProcessor.CameraRemoveEvent += ImageProcessorCameraRemoveEvent; _imageProcessor.InitializeProcessor(); _cameraStreamSynchronize = new AutoResetEvent(false); OpenSession(); if (!_sessionOpened) { return; } StartLiveView(); }