コード例 #1
0
        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();
            }
        }
コード例 #2
0
        public void SetCameraSettings()
        {
            //  _imageProcessor.SetSetting((uint)PropertyId.AEMode, (uint)SelectedAeMode); TODO Не поддерживается.
            _imageProcessor.SetSetting((uint)PropertyId.WhiteBalance, (uint)SelectedWhiteBalance);
            _imageProcessor.SetSetting((uint)PropertyId.Av, (uint)SelectedAvValue);

            //_imageProcessor.SetSetting((uint)PropertyId.ExposureCompensation, (uint)));
            _imageProcessor.SetSetting((uint)PropertyId.ISOSpeed, (uint)SelectedIsoSensitivity);
            _imageProcessor.SetSetting((uint)PropertyId.Tv, (uint)SelectedShutterSpeed);
        }
コード例 #3
0
 private void StartLiveView()
 {
     _imageProcessor.StartLiveView();
     _settings = _settingsProvider.GetCameraSettings();
     if (_settings != null)
     {
         _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);
     }
     _isLiveViewOn = true;
 }
コード例 #4
0
        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();
        }