Пример #1
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();
        }