Exemplo n.º 1
0
        public void StartExposure(double Duration, bool Light)
        {
            Logger.WriteTraceMessage("StartExposure");
            _canceled.IsCanceled = false;

            _startTime = DateTime.Now;
            _duration  = Duration;
            var camera = DeviceManager.SelectedCameraDevice;

            Logger.WriteTraceMessage("Device Selected: " + camera.DeviceName);
            camera.IsoNumber.Value = GetNearesetValue(camera.IsoNumber, Iso);
            Logger.WriteTraceMessage("GetNearesetValue ISO: " + Iso.ToString());
            camera.CompressionSetting.Value = camera.CompressionSetting.Values.SingleOrDefault(v => v.ToUpper() == "RAW");
            Logger.WriteTraceMessage("SetRaw: ");
            bool canBulb = camera.GetCapability(CapabilityEnum.Bulb);

            Logger.WriteTraceMessage("CanBulb: " + canBulb.ToString());
            Logger.WriteTraceMessage("Exposure Duration: " + Duration.ToString());
            if (Duration > 30)
            {
                int durationMsec = (int)(Duration * 1000);
                if (UseExternalShutter)
                {
                    ThreadPool.QueueUserWorkItem(state =>
                    {
                        var _serialPortShutter = new SerialPortShutterRelease(ExternalShutterPort);
                        BulbExposure(durationMsec, _canceled, _serialPortShutter.OpenShutter, _serialPortShutter.CloseShutter);
                    });
                }
                else
                {
                    if (canBulb)
                    {
                        ThreadPool.QueueUserWorkItem(state =>
                        {
                            Logger.WriteTraceMessage("Start BulbExposure");
                            BulbExposure(durationMsec, _canceled, camera.StartBulbMode, camera.EndBulbMode);
                            Logger.WriteTraceMessage("End BulbExposure");
                        });
                    }
                }
            }
            else
            {
                if (Duration >= 1)
                {
                    camera.ShutterSpeed.Value = Duration + "s";
                }
                else
                {
                    camera.ShutterSpeed.Value = GetNearesetValue(camera.ShutterSpeed, Duration);
                }
                Logger.WriteTraceMessage("GetNearesetValue Shutter");
                DeviceManager.SelectedCameraDevice.CapturePhoto();
                Logger.WriteTraceMessage("CapturePhoto");
            }
        }
Exemplo n.º 2
0
        public void StartExposure(double Duration, bool Light)
        {
            _canceled.IsCanceled = false;

            _startTime = DateTime.Now;
            _duration  = Duration;
            var camera = DeviceManager.SelectedCameraDevice;

            camera.IsoNumber.Value          = GetNearesetValue(camera.IsoNumber, Iso);
            camera.CompressionSetting.Value = camera.CompressionSetting.Values.SingleOrDefault(v => v.ToUpper() == "RAW");
            bool canBulb = camera.GetCapability(CapabilityEnum.Bulb);

            if (Duration > 30)
            {
                int durationMsec = (int)(Duration * 1000);
                if (UseExternalShutter)
                {
                    ThreadPool.QueueUserWorkItem(state =>
                    {
                        var _serialPortShutter = new SerialPortShutterRelease(ExternalShutterPort);
                        BulbExposure(durationMsec, _canceled, _serialPortShutter.OpenShutter, _serialPortShutter.CloseShutter);
                    });
                }
                else
                {
                    ThreadPool.QueueUserWorkItem(state =>
                    {
                        BulbExposure(durationMsec, _canceled, camera.StartBulbMode, camera.EndBulbMode);
                    });
                }
            }
            else
            {
                camera.ShutterSpeed.Value = GetNearesetValue(camera.ShutterSpeed, Duration);
                DeviceManager.SelectedCameraDevice.CapturePhoto();
            }
        }