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

            do
            {
                retry = false;
                try
                {
                    if (DefaultScript.UseExternal)
                    {
                        if (DefaultScript.SelectedConfig != null)
                        {
                            ServiceProvider.ExternalDeviceManager.CloseShutter(DefaultScript.SelectedConfig);
                            NikonBase nikonBase = CameraDevice as NikonBase;
                            if (nikonBase != null)
                            {
                                nikonBase.StartEventTimer();
                            }
                        }
                        else
                        {
                            MessageBox.Show(TranslationStrings.LabelNoExternalDeviceSelected);
                        }
                    }
                    else
                    {
                        if (CameraDevice.GetCapability(CapabilityEnum.Bulb))
                        {
                            CameraDevice.EndBulbMode();
                        }
                        else
                        {
                            StaticHelper.Instance.SystemMessage = TranslationStrings.MsgBulbModeNotSupported;
                        }
                    }
                    //CountDown = 0;
                    StaticHelper.Instance.SystemMessage = "Capture done";
                    Log.Debug("Bulb capture done");
                }
                catch (DeviceException deviceException)
                {
                    if (deviceException.ErrorCode == ErrorCodes.ERROR_BUSY)
                    {
                        retry = true;
                    }
                    else
                    {
                        StaticHelper.Instance.SystemMessage = deviceException.Message;
                        Log.Error("Bulb done", deviceException);
                    }
                }
                catch (Exception exception)
                {
                    StaticHelper.Instance.SystemMessage = exception.Message;
                    Log.Error("Bulb done", exception);
                }
            } while (retry);
        }