private void CaptureNextPhoto() { Log.Debug("Bracketing take next photo"); switch (Mode) { case 0: { try { _cameraDevice.ExposureCompensation.SetValue(ExposureValues[Index]); CameraHelper.Capture(_cameraDevice); Index++; } catch (DeviceException exception) { Log.Error(exception); StaticHelper.Instance.SystemMessage = exception.Message; } } break; case 1: { try { _cameraDevice.ShutterSpeed.SetValue(ShutterValues[Index]); CameraHelper.Capture(_cameraDevice); Index++; } catch (DeviceException exception) { Log.Error(exception); StaticHelper.Instance.SystemMessage = exception.Message; } } break; case 2: { try { CameraPreset preset = ServiceProvider.Settings.GetPreset(PresetValues[Index]); if (preset != null) { preset.Set(_cameraDevice); } CameraHelper.Capture(_cameraDevice); Index++; } catch (DeviceException exception) { Log.Error(exception); StaticHelper.Instance.SystemMessage = exception.Message; } } break; } }
private void KeyDownThread(KeyboardHookEventArgs e) { _eventIsBusy = true; try { Key inputKey = KeyInterop.KeyFromVirtualKey((int)e.Key); foreach (var item in ServiceProvider.Settings.Actions) { if (!item.Global) { continue; } if (item.Alt == e.isAltPressed && item.Ctrl == e.isCtrlPressed && item.KeyEnum == inputKey) { ServiceProvider.WindowsManager.ExecuteCommand(item.Name); } } ICameraDevice lastDevice = null; foreach (ICameraDevice device in ServiceProvider.DeviceManager.ConnectedDevices) { if (lastDevice != null) { lastDevice.WaitForCamera(1500); } // wait for camera to finish last transfer with timeot of 1.5 sec device.WaitForCamera(1500); // skip camera is camera is still busy if (device.IsBusy) { continue; } CameraProperty property = device.LoadProperties(); if (property.KeyTrigger.KeyEnum != Key.None && property.KeyTrigger.Alt == e.isAltPressed && property.KeyTrigger.Ctrl == e.isCtrlPressed && property.KeyTrigger.KeyEnum == inputKey) { CameraHelper.Capture(device); lastDevice = device; } if (property.KeyTriggerNoAF.KeyEnum != Key.None && property.KeyTriggerNoAF.Alt == e.isAltPressed && property.KeyTriggerNoAF.Ctrl == e.isCtrlPressed && property.KeyTriggerNoAF.KeyEnum == inputKey) { CameraHelper.CaptureNoAf(device); lastDevice = device; } } } catch (Exception exception) { StaticHelper.Instance.SystemMessage = exception.Message; Log.Error("Key trigger ", exception); } _eventIsBusy = false; }
private void StartCapture(object o) { try { CameraHelper.Capture(o); } catch (Exception exception) { Log.Error("Error capture:", exception); StaticHelper.Instance.SystemMessage = exception.Message; } }
private void Capture() { try { WaitForReady(ServiceProvider.DeviceManager.SelectedCameraDevice); if (NoAutofocus && ServiceProvider.DeviceManager.SelectedCameraDevice.GetCapability(CapabilityEnum.CaptureNoAf)) { CameraHelper.CaptureNoAf(ServiceProvider.DeviceManager.SelectedCameraDevice); } else { CameraHelper.Capture(ServiceProvider.DeviceManager.SelectedCameraDevice); } //_timer.Enabled = true; } catch (Exception exception) { Log.Error(exception); StaticHelper.Instance.SystemMessage = exception.Message; } }
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) { Stop(); 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) { Stop(); 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) { Stop(); 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; case 3: { if (ApertureValues.Count == 0) { Stop(); return; } Index = 0; try { _defec = _cameraDevice.FNumber.Value; Thread.Sleep(100); _cameraDevice.FNumber.SetValue(ApertureValues[Index]); Thread.Sleep(100); CameraHelper.Capture(_cameraDevice); Index++; } catch (DeviceException exception) { Log.Error(exception); StaticHelper.Instance.SystemMessage = exception.Message; } } break; } }