Ejemplo n.º 1
0
 private void RemoteCapture_FormClosing(object sender, FormClosingEventArgs e)
 {
     Application.DoEvents();
     if (!_controller.GetModel().isTypeDS)
     {
         _actionSource.FireEvent(ActionEvent.Command.REMOTESHOOTING_STOP, IntPtr.Zero);
     }
     _actionSource.FireEvent(ActionEvent.Command.PRESS_OFF, IntPtr.Zero);
     _actionSource.FireEvent(ActionEvent.Command.EVF_AF_OFF, IntPtr.Zero);
     _actionSource.FireEvent(ActionEvent.Command.END_EVF, IntPtr.Zero);
     _observerList.ForEach(observer => _controller.GetModel().Remove(ref observer));
 }
Ejemplo n.º 2
0
 protected override void OnSelectionChangeCommitted(EventArgs e)
 {
     if (this.SelectedItem != null)
     {
         uint key = (uint)_desc.PropDesc[this.SelectedIndex];
         _actionSource.FireEvent(ActionEvent.Command.SET_EXPOSURE_COMPENSATION, (IntPtr)key);
     }
 }
Ejemplo n.º 3
0
        public RotationDialog(ref CameraController controller, ref ActionSource actionSource)
        {
            IObserver iObs = this;

            InitializeComponent();
            frmRotationDialog = this;
            _controller       = controller;
            _actionSource     = actionSource;

            progressLabel.Text = $"{currentPhoto} / {photosPerRotation}";

            _actionSource.FireEvent(ActionEvent.Command.TAKE_PICTURE, IntPtr.Zero);
        }
Ejemplo n.º 4
0
 private void _MouseUp(object sender, MouseEventArgs e)
 {
     _actionSource.FireEvent(ActionEvent.Command.SET_ZOOM, (IntPtr)this.Value);
 }
Ejemplo n.º 5
0
        protected override void OnClick(EventArgs e)
        {
            _actionSource.FireEvent(this.Command, IntPtr.Zero);

            base.OnClick(e);
        }
Ejemplo n.º 6
0
        public RemoteCapture(ref CameraController controller, ref ActionSource actionSource)
        {
            InitializeComponent();

            _controller = controller;

            _actionSource = actionSource;

            CameraEvent e;

            _observerList.Add((IObserver)aeMode1);
            _observerList.Add((IObserver)av1);
            _observerList.Add((IObserver)evfPictureBox1);
            _observerList.Add((IObserver)tv1);
            _observerList.Add((IObserver)iso1);
            _observerList.Add((IObserver)meteringMode1);
            _observerList.Add((IObserver)exposureComp1);
            _observerList.Add((IObserver)imageQuality1);
            _observerList.Add((IObserver)evfAFMode1);
            _observerList.Add((IObserver)driveMode1);
            _observerList.Add((IObserver)whiteBalance1);
            _observerList.Add((IObserver)availableShotLabel1);
            _observerList.Add((IObserver)batteryLebelLabel1);
            _observerList.Add((IObserver)zoom1);
            _observerList.Add((IObserver)afMode1);
            _observerList.Add((IObserver)flashMode1);
            _observerList.Add((IObserver)downloadProgressBar1);
            _observerList.Add((IObserver)tempStatusLabel1);
            _observerList.Add((IObserver)movieQuality1);

            System.Threading.Thread.Sleep(1000);

            _observerList.ForEach(observer => _controller.GetModel().Add(ref observer));

            aeMode1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_AEModeSelect);
            _controller.GetModel().NotifyObservers(e);

            av1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Av);
            _controller.GetModel().NotifyObservers(e);

            evfPictureBox1.SetActionSource(ref _actionSource);

            tv1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Tv);
            _controller.GetModel().NotifyObservers(e);


            iso1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_ISOSpeed);
            _controller.GetModel().NotifyObservers(e);


            meteringMode1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_MeteringMode);
            _controller.GetModel().NotifyObservers(e);


            exposureComp1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_ExposureCompensation);
            _controller.GetModel().NotifyObservers(e);


            imageQuality1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_ImageQuality);
            _controller.GetModel().NotifyObservers(e);


            evfAFMode1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Evf_AFMode);
            _controller.GetModel().NotifyObservers(e);


            driveMode1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_DriveMode);
            _controller.GetModel().NotifyObservers(e);


            whiteBalance1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_WhiteBalance);
            _controller.GetModel().NotifyObservers(e);

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_AFMode);
            _controller.GetModel().NotifyObservers(e);

            flashMode1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_DC_Strobe);
            _controller.GetModel().NotifyObservers(e);

            movieQuality1.SetActionSource(ref _actionSource);
            e = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_MovieParam);
            _controller.GetModel().NotifyObservers(e);

            zoom1.SetActionSource(ref _actionSource);
            label16.Text = zoom1.Value.ToString();
            e            = new CameraEvent(CameraEvent.Type.PROPERTY_DESC_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_DC_Zoom);
            _controller.GetModel().NotifyObservers(e);

            actionButton1.SetActionSource(ref _actionSource);
            actionButton1.Command = ActionEvent.Command.TAKE_PICTURE;

            actionButton3.SetActionSource(ref _actionSource);
            actionButton3.Command = ActionEvent.Command.PRESS_COMPLETELY;

            actionButton2.SetActionSource(ref _actionSource);
            actionButton2.Command = ActionEvent.Command.PRESS_HALFWAY;

            actionButton4.SetActionSource(ref _actionSource);
            actionButton4.Command = ActionEvent.Command.PRESS_OFF;

            actionButton5.SetActionSource(ref _actionSource);
            actionButton5.Command = ActionEvent.Command.START_EVF;

            actionButton6.SetActionSource(ref _actionSource);
            actionButton6.Command = ActionEvent.Command.END_EVF;

            actionButton10.SetActionSource(ref _actionSource);
            actionButton10.Command = ActionEvent.Command.FOCUS_NEAR3;

            actionButton11.SetActionSource(ref _actionSource);
            actionButton11.Command = ActionEvent.Command.FOCUS_NEAR2;

            actionButton12.SetActionSource(ref _actionSource);
            actionButton12.Command = ActionEvent.Command.FOCUS_NEAR1;

            actionButton13.SetActionSource(ref _actionSource);
            actionButton13.Command = ActionEvent.Command.FOCUS_FAR1;

            actionButton14.SetActionSource(ref _actionSource);
            actionButton14.Command = ActionEvent.Command.FOCUS_FAR2;

            actionButton15.SetActionSource(ref _actionSource);
            actionButton15.Command = ActionEvent.Command.FOCUS_FAR3;

            actionButton7.SetActionSource(ref _actionSource);
            actionButton7.Command = ActionEvent.Command.EVF_AF_ON;

            actionButton8.SetActionSource(ref _actionSource);
            actionButton8.Command = ActionEvent.Command.EVF_AF_OFF;

            actionButton9.SetActionSource(ref _actionSource);
            actionButton9.Command = ActionEvent.Command.ZOOM_FIT;

            actionButton16.SetActionSource(ref _actionSource);
            actionButton16.Command = ActionEvent.Command.ZOOM_ZOOM;

            actionButton17.SetActionSource(ref _actionSource);
            actionButton17.Command = ActionEvent.Command.POSITION_UP;

            actionButton18.SetActionSource(ref _actionSource);
            actionButton18.Command = ActionEvent.Command.POSITION_LEFT;

            actionButton19.SetActionSource(ref _actionSource);
            actionButton19.Command = ActionEvent.Command.POSITION_RIGHT;

            actionButton20.SetActionSource(ref _actionSource);
            actionButton20.Command = ActionEvent.Command.POSITION_DOWN;

            actionButton21.SetActionSource(ref _actionSource);
            actionButton21.Command = ActionEvent.Command.REC_START;

            actionButton22.SetActionSource(ref _actionSource);
            actionButton22.Command = ActionEvent.Command.REC_END;

            actionButton23.SetActionSource(ref _actionSource);
            actionButton23.Command = ActionEvent.Command.ROLLPITCH;
            actionButton23.Text    = "Roll Pitch On";

            actionButton24.SetActionSource(ref _actionSource);
            actionButton24.Command = ActionEvent.Command.CLICK_WB;

            actionRadioButton1.SetActionSource(ref _actionSource);
            actionRadioButton1.Command = ActionEvent.Command.PRESS_STILL;

            actionRadioButton2.SetActionSource(ref _actionSource);
            actionRadioButton2.Command = ActionEvent.Command.PRESS_MOVIE;
            // movieMode 0 : Disable , 1 : Enable
            uint movieMode;
            // Get movie mode.
            uint err = EDSDKLib.EDSDK.EdsGetPropertyData(_controller.GetModel().Camera, EDSDKLib.EDSDK.PropID_FixedMovie, 0, out movieMode);

            updateFixedMovie(movieMode);

            actionRadioButton3.SetActionSource(ref _actionSource);
            actionRadioButton3.Command = ActionEvent.Command.MIRRORUP_ON;

            actionRadioButton4.SetActionSource(ref _actionSource);
            actionRadioButton4.Command = ActionEvent.Command.MIRRORUP_OFF;
            // mirrorUpStatus 0 : Disable , 1 : Enable , 2 : During shooting
            uint mirrorLockUpState;

            // Get Mirror Lockup Status.
            err = EDSDKLib.EDSDK.EdsGetPropertyData(_controller.GetModel().Camera, EDSDKLib.EDSDK.PropID_MirrorLockUpState, 0, out mirrorLockUpState);
            // Mirror Up Settings Enabled
            if (mirrorLockUpState == (uint)EDSDKLib.EDSDK.EdsMirrorLockupState.Enable)
            {
                actionRadioButton3.Checked = true;
            }
            else
            {
                actionRadioButton4.Checked = true;
            }

            controlFocusButton((int)EDSDKLib.EDSDK.EdsEvfAFMode.Evf_AFMode_LiveFace != _controller.GetModel().EvfAFMode);

            // invalidate it in the DC
            label26.Enabled        = _controller.GetModel().isTypeDS;
            actionButton9.Enabled  = _controller.GetModel().isTypeDS;
            actionButton16.Enabled = _controller.GetModel().isTypeDS;
            label19.Enabled        = _controller.GetModel().isTypeDS;
            // Processing inside updateFixedMovie
            //actionButton10.Enabled = _controller.GetModel().isTypeDS;
            //actionButton11.Enabled = _controller.GetModel().isTypeDS;
            //actionButton12.Enabled = _controller.GetModel().isTypeDS;
            //actionButton13.Enabled = _controller.GetModel().isTypeDS;
            //actionButton14.Enabled = _controller.GetModel().isTypeDS;
            //actionButton15.Enabled = _controller.GetModel().isTypeDS;

            // invalidate it in the DS
            label18.Enabled    = !_controller.GetModel().isTypeDS;
            flashMode1.Enabled = !_controller.GetModel().isTypeDS;
            label15.Enabled    = !_controller.GetModel().isTypeDS;
            zoom1.Enabled      = false; // At the time of start, ZoomBar is off
            label16.Enabled    = !_controller.GetModel().isTypeDS;

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_Evf_AFMode);
            _controller.GetModel().NotifyObservers(e);

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_AvailableShots);
            _controller.GetModel().NotifyObservers(e);

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_BatteryLevel);
            _controller.GetModel().NotifyObservers(e);

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_TempStatus);
            _controller.GetModel().NotifyObservers(e);

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_FixedMovie);
            _controller.GetModel().NotifyObservers(e);

            e = new CameraEvent(CameraEvent.Type.PROPERTY_CHANGED, (IntPtr)EDSDKLib.EDSDK.PropID_MirrorUpSetting);
            _controller.GetModel().NotifyObservers(e);

            if (!_controller.GetModel().isTypeDS)
            {
                _actionSource.FireEvent(ActionEvent.Command.REMOTESHOOTING_START, IntPtr.Zero);
            }

            updateAngleInfoLabel("-", "-", "-");
        }
Ejemplo n.º 7
0
        public void Update(Observable from, CameraEvent e)
        {
            CameraEvent.Type eventType = e.GetEventType();

            switch (eventType)
            {
            case CameraEvent.Type.SHUT_DOWN:

                MessageBox.Show("Camera is disconnected");

                if (_remoteCapture != null && !_remoteCapture.IsDisposed)
                {
                    _remoteCapture.Close();
                    _remoteCapture.Dispose();
                }

                this.Close();

                break;

            case CameraEvent.Type.PROPERTY_CHANGED:
                if (null != _remoteCapture)
                {
                    uint propertyID = (uint)e.GetArg();
                    if (propertyID == EDSDKLib.EDSDK.PropID_Evf_AFMode)
                    {
                        (_remoteCapture as RemoteCapture).controlFocusButton((int)EDSDKLib.EDSDK.EdsEvfAFMode.Evf_AFMode_LiveFace != _controller.GetModel().EvfAFMode);
                    }
                    if (propertyID == EDSDKLib.EDSDK.PropID_FixedMovie)
                    {
                        (_remoteCapture as RemoteCapture).updateFixedMovie(_controller.GetModel().FixedMovie);
                    }
                    if (propertyID == EDSDKLib.EDSDK.PropID_MirrorUpSetting)
                    {
                        (_remoteCapture as RemoteCapture).updateMirrorLockup(_controller.GetModel().MirrorUpSetting);
                    }
                }
                break;

            case CameraEvent.Type.ANGLEINFO:
                if (null != _remoteCapture)
                {
                    IntPtr cameraPosPtr = e.GetArg();
                    if (cameraPosPtr != IntPtr.Zero)
                    {
                        EDSDKLib.EDSDK.EdsCameraPos cameraPos = (EDSDKLib.EDSDK.EdsCameraPos)Marshal.PtrToStructure(cameraPosPtr, typeof(EDSDKLib.EDSDK.EdsCameraPos));
                        double pos = cameraPos.position;
                        // Convert to floating point
                        double roll = cameraPos.rolling * 0.01;
                        double pitc = cameraPos.pitching * 0.01;
                        (_remoteCapture as RemoteCapture).updateAngleInfoLabel(pos.ToString(), roll.ToString(), pitc.ToString());
                    }
                    else
                    {
                        uint err = EDSDKLib.EDSDK.EdsSendCommand(_controller.GetModel().Camera, EDSDKLib.EDSDK.CameraCommand_RequestRollPitchLevel, 1);
                        (_remoteCapture as RemoteCapture).updateAngleInfoLabel("-", "-", "-");
                    }
                }
                break;

            case CameraEvent.Type.MOUSE_CURSOR:
                if (null != _remoteCapture)
                {
                    IntPtr onOffPtr = e.GetArg();
                    if (onOffPtr != IntPtr.Zero)
                    {
                        (_remoteCapture as RemoteCapture).changeMouseCursor(true);
                    }
                    else
                    {
                        (_remoteCapture as RemoteCapture).changeMouseCursor(false);
                        _actionSource.FireEvent(ActionEvent.Command.CLICK_MOUSE, IntPtr.Zero);
                    }
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 8
0
        public void Update(Observable from, CameraEvent e)
        {
            if (this.InvokeRequired)
            {
                //The update processing can be executed from another thread.
                this.Invoke(new _Update(Update), new object[] { from, e });
                return;
            }

            CameraEvent.Type eventType = e.GetEventType();
            _model = (CameraModel)from;
            uint propertyID;

            switch (eventType)
            {
            case CameraEvent.Type.EVFDATA_CHANGED:
                IntPtr evfDataSetPtr = e.GetArg();

                EVFDataSet evfDataSet = (EVFDataSet)Marshal.PtrToStructure(evfDataSetPtr, typeof(EVFDataSet));

                this.OnDrawImage(evfDataSet);

                propertyID = EDSDKLib.EDSDK.PropID_FocusInfo;

                _actionSource.FireEvent(ActionEvent.Command.GET_PROPERTY, (IntPtr)propertyID);

                _actionSource.FireEvent(ActionEvent.Command.DOWNLOAD_EVF, IntPtr.Zero);

                break;

            case CameraEvent.Type.PROPERTY_CHANGED:
                propertyID = (uint)e.GetArg();

                if (propertyID == EDSDKLib.EDSDK.PropID_Evf_OutputDevice)
                {
                    uint device = _model.EvfOutputDevice;

                    // PC live view has started.
                    if (!_active && (device & EDSDKLib.EDSDK.EvfOutputDevice_PC) != 0)
                    {
                        _active = true;
                        // Start download of image data.
                        _actionSource.FireEvent(ActionEvent.Command.DOWNLOAD_EVF, IntPtr.Zero);
                    }

                    // PC live view has ended.
                    if (_active && (device & EDSDKLib.EDSDK.EvfOutputDevice_PC) == 0)
                    {
                        _active = false;
                    }
                }

                else if (propertyID == EDSDKLib.EDSDK.PropID_FocusInfo && this.Image != null)
                {
                    float xRatio = 1;
                    float yRatio = 1;

                    m_focusInfo = _model.FocusInfo;

                    xRatio = (float)(this.Image.Width) / (float)(m_focusInfo.imageRect.width);
                    yRatio = (float)(this.Image.Height) / (float)(m_focusInfo.imageRect.height);
                    for (uint i = 0; i < m_focusInfo.pointNumber; i++)
                    {
                        m_focusInfo.focusPoint[i].rect.x      = (int)(m_focusInfo.focusPoint[i].rect.x * xRatio);
                        m_focusInfo.focusPoint[i].rect.y      = (int)(m_focusInfo.focusPoint[i].rect.y * yRatio);
                        m_focusInfo.focusPoint[i].rect.width  = (int)(m_focusInfo.focusPoint[i].rect.width * xRatio);
                        m_focusInfo.focusPoint[i].rect.height = (int)(m_focusInfo.focusPoint[i].rect.height * yRatio);
                    }
                }

                else if (propertyID == EDSDKLib.EDSDK.PropID_Evf_AFMode)
                {
                    m_bDrawZoomFrame = _model.EvfAFMode != 2 && _model.isTypeDS;
                }

                break;
            }
        }