Example #1
0
        public void TakePhoto(ICameraDevice device)
        {
            _cameraDevice = device;
            Log.Debug("Bracketing started");
            _cameraDevice.CaptureCompleted += _cameraDevice_CaptureCompleted;
            IsBusy = true;
            switch (Mode)
            {
            case 0:
            {
                if (ExposureValues.Count == 0)
                {
                    return;
                }
                Index = 0;
                try
                {
                    _defec = _cameraDevice.ExposureCompensation.Value;
                    Thread.Sleep(100);
                    _cameraDevice.ExposureCompensation.SetValue(ExposureValues[Index]);
                    Thread.Sleep(100);
                    CameraHelper.Capture(_cameraDevice);
                    Index++;
                }
                catch (DeviceException exception)
                {
                    Log.Error(exception);
                    StaticHelper.Instance.SystemMessage = exception.Message;
                }
            }
            break;

            case 1:
            {
                if (ShutterValues.Count == 0)
                {
                    return;
                }
                Index = 0;
                try
                {
                    _defec = _cameraDevice.ShutterSpeed.Value;
                    Thread.Sleep(100);
                    _cameraDevice.ShutterSpeed.SetValue(ShutterValues[Index]);
                    Thread.Sleep(100);
                    CameraHelper.Capture(_cameraDevice);
                    Index++;
                }
                catch (DeviceException exception)
                {
                    Log.Error(exception);
                    StaticHelper.Instance.SystemMessage = exception.Message;
                }
            }
            break;

            case 2:
            {
                if (PresetValues.Count == 0)
                {
                    return;
                }
                Index = 0;
                try
                {
                    _cameraPreset.Get(_cameraDevice);
                    Thread.Sleep(100);
                    CameraPreset preset = ServiceProvider.Settings.GetPreset(PresetValues[Index]);
                    if (preset != null)
                    {
                        preset.Set(_cameraDevice);
                    }
                    Thread.Sleep(100);
                    CameraHelper.Capture(_cameraDevice);
                    Index++;
                }
                catch (DeviceException exception)
                {
                    Log.Error(exception);
                    StaticHelper.Instance.SystemMessage = exception.Message;
                }
            }
            break;
            }
        }