コード例 #1
0
        void StartCaptureThread()
        {
            bool retry;

            do
            {
                retry = false;
                try
                {
                    Log.Debug("Bulb capture started");
                    if (DefaultScript.UseExternal)
                    {
                        if (DefaultScript.SelectedConfig != null)
                        {
                            ServiceProvider.ExternalDeviceManager.Start(DefaultScript.SelectedConfig);
                        }
                        else
                        {
                            MessageBox.Show(TranslationStrings.LabelNoExternalDeviceSelected);
                        }
                    }
                    else
                    {
                        if (CameraDevice.GetCapability(CapabilityEnum.Bulb))
                        {
                            CameraDevice.LockCamera();
                            CameraDevice.StartBulbMode();
                        }
                        else
                        {
                            StaticHelper.Instance.SystemMessage = TranslationStrings.MsgBulbModeNotSupported;
                        }
                    }
                }
                catch (DeviceException deviceException)
                {
                    if (deviceException.ErrorCode == ErrorCodes.ERROR_BUSY)
                    {
                        retry = true;
                    }
                    else
                    {
                        StaticHelper.Instance.SystemMessage = deviceException.Message;
                        Log.Error("Bulb start", deviceException);
                    }
                }
                catch (Exception exception)
                {
                    StaticHelper.Instance.SystemMessage = exception.Message;
                    Log.Error("Bulb start", exception);
                }
            } while (retry);

            _waitSecs    = 0;
            _captureSecs = 0;
            _captureTimer.Start();
        }
コード例 #2
0
        private void StartCaptureThread()
        {
            bool retry;

            Message = "";
            do
            {
                retry = false;
                try
                {
                    Log.Debug("Bulb capture started");
                    CountDown = CaptureTime;
                    Event     = "Capture";
                    PhotoLeft--;
                    if (DefaultScript.UseExternal)
                    {
                        if (DefaultScript.SelectedConfig != null)
                        {
                            NikonBase nikonBase = CameraDevice as NikonBase;
                            if (nikonBase != null)
                            {
                                nikonBase.StopEventTimer();
                            }
                            ServiceProvider.ExternalDeviceManager.OpenShutter(DefaultScript.SelectedConfig);
                        }
                        else
                        {
                            MessageBox.Show(TranslationStrings.LabelNoExternalDeviceSelected);
                        }
                    }
                    else
                    {
                        if (CameraDevice.GetCapability(CapabilityEnum.Bulb))
                        {
                            expDelay   = CameraDevice.GetExposureDelay();
                            CountDown += expDelay;
                            waitDelay  = CameraDevice.GetPropertyValue(NikonBase.CONST_PROP_NoiseReduction) == "ON" ? CaptureTime : 0;
                            ServiceProvider.DeviceManager.LastCapturedImage[CameraDevice] = "-";
                            CameraDevice.IsBusy = true;
                            CameraDevice.LockCamera();
                            CameraDevice.StartBulbMode();
                        }
                        else
                        {
                            StaticHelper.Instance.SystemMessage = TranslationStrings.MsgBulbModeNotSupported;
                        }
                    }
                }
                catch (DeviceException deviceException)
                {
                    if (deviceException.ErrorCode == ErrorCodes.ERROR_BUSY)
                    {
                        retry = true;
                    }
                    else
                    {
                        StaticHelper.Instance.SystemMessage = deviceException.Message;
                        Log.Error("Bulb start", deviceException);
                        CameraDevice.IsBusy = false;
                    }
                }
                catch (Exception exception)
                {
                    StaticHelper.Instance.SystemMessage = exception.Message;
                    Log.Error("Bulb start", exception);
                    Event               = "Error";
                    CountDown           = 0;
                    CameraDevice.IsBusy = false;
                    return;
                }
            } while (retry);
            _waitSecs    = 0;
            _captureSecs = 0;
            _captureTimer.Start();
        }
コード例 #3
0
        private void StartCaptureThread()
        {
            bool retry;

            Message = "";
            do
            {
                retry = false;
                try
                {
                    Log.Debug("Bulb capture started");
                    CountDown = CaptureTime;
                    Event     = "Capture";
                    PhotoLeft--;
                    if (DefaultScript.UseExternal)
                    {
                        if (DefaultScript.SelectedConfig != null)
                        {
                            NikonBase nikonBase = CameraDevice as NikonBase;
                            if (nikonBase != null)
                            {
                                nikonBase.StopEventTimer();
                            }
                            ServiceProvider.ExternalDeviceManager.OpenShutter(DefaultScript.SelectedConfig);
                        }
                        else
                        {
                            MessageBox.Show(TranslationStrings.LabelNoExternalDeviceSelected);
                        }
                    }
                    else
                    {
                        if (CameraDevice.GetCapability(CapabilityEnum.Bulb))
                        {
                            AsyncObservableCollection <PropertyValue <long> > coll = CameraDevice.AdvancedProperties;
                            foreach (PropertyValue <long> prop in coll)
                            {
                                if (prop.Code == 0xD06A && !string.IsNullOrEmpty(prop.Value)) //.Name == "Exposure delay mode")
                                {
                                    if (prop.Value != "OFF")
                                    {
                                        expDelay = int.Parse(prop.Value.Substring(0, 1));
                                        //expDelay = (int)prop.NumericValue;
                                        CountDown += expDelay;
                                    }
                                    else
                                    {
                                        expDelay = 0;
                                    }
                                }
                                else if (prop.Code == NikonBase.CONST_PROP_NoiseReduction && prop.Value != null)
                                {
                                    waitDelay = prop.Value == "ON" ? CaptureTime : 0;
                                }
                            }
                            ServiceProvider.DeviceManager.LastCapturedImage[CameraDevice] = "";
                            CameraDevice.IsBusy = true;
                            CameraDevice.LockCamera();
                            CameraDevice.StartBulbMode();
                        }
                        else
                        {
                            StaticHelper.Instance.SystemMessage = TranslationStrings.MsgBulbModeNotSupported;
                        }
                    }
                }
                catch (DeviceException deviceException)
                {
                    if (deviceException.ErrorCode == ErrorCodes.ERROR_BUSY)
                    {
                        retry = true;
                    }
                    else
                    {
                        StaticHelper.Instance.SystemMessage = deviceException.Message;
                        Log.Error("Bulb start", deviceException);
                        CameraDevice.IsBusy = false;
                    }
                }
                catch (Exception exception)
                {
                    StaticHelper.Instance.SystemMessage = exception.Message;
                    Log.Error("Bulb start", exception);
                    Event               = "Error";
                    CountDown           = 0;
                    CameraDevice.IsBusy = false;
                    return;
                }
            } while (retry);
            _waitSecs    = 0;
            _captureSecs = 0;
            _captureTimer.Start();
        }