public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); // DS does not need zoom step value if (propertyID == EDSDKLib.EDSDK.PropID_DC_Zoom && !model.isTypeDS) { uint property = model.Zoom; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.ZoomDesc; this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_MeteringMode) { uint property = model.MeteringMode; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.MeteringModeDesc; this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_MovieParam) { uint property = model.MovieQuality; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.MovieQualityDesc; // Ignore PropertyDesc when shooting still images. if (model.FixedMovie == 0) { _desc.NumElements = 0; } this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } } }
public void Update(Observable from, CameraEvent e) { CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_BatteryLevel) { //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: CameraModel model = (CameraModel)from; string infoText = "AC power"; if (0xffffffff != model.BatteryLebel) { infoText = model.BatteryLebel.ToString() + "%"; } this.UpdateProperty(infoText); break; } } } }
public void Update(Observable from, CameraEvent e) { CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_TempStatus) { //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: CameraModel model = (CameraModel)from; var infoText = new string[] { "Normal", "Warning", "Frameratedown", "Disableliveview", "Disablerelease", "Stillqualitywarning", "unknown" }; if (infoText.Length > model.TempStatus) { this.UpdateProperty(infoText[model.TempStatus]); } else { this.UpdateProperty(infoText[infoText.Length - 1]); } break; } } } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROGRESS) { uint percentage = (uint)e.GetArg(); this.UpdateProperty(percentage); } if ((eventType = e.GetEventType()) == CameraEvent.Type.DOWNLOAD_COMPLETE) { System.Threading.Thread.Sleep(1000); uint percentage = (uint)0; this.UpdateProperty(percentage); } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_Evf_AFMode) { uint property = model.EvfAFMode; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: // At the time of application start, if the camera setting is 'Catch AF', make 'Evf_AFMode_LiveFace' forcibly. if (0x09 == property) { EDSDKLib.EDSDK.EdsSetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_Evf_AFMode, 0, sizeof(uint), 0x02); } else { this.UpdateProperty(property); } break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: // If property is 'Catch AF', do not call UpdateProperty(). _desc = model.EvfAFModeDesc; this.UpdatePropertyDesc(ref _desc); if (0x09 != property) { this.UpdateProperty(property); } break; } } } }
private void Update(CameraEvent e) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _Update(Update), new object[] { e }); return; } CameraEvent.Type eventType = e.GetEventType(); switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: UpdateItems((uint)e.GetArg()); break; default: break; } }
private void Update(CameraEvent e) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _Update(Update), new object[] { e }); return; } CameraEvent.Type eventType = e.GetEventType(); switch (eventType) { case CameraEvent.Type.SHUT_DOWN: CameraModel cameramodel = _controller.GetModel(); cameramodel._ExecuteStatus = CameraModel.Status.CANCELING; break; default: break; } }
public void Update(Observable from, CameraEvent e) { CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_AvailableShots) { //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: CameraModel model = (CameraModel)from; string infoText = ""; infoText = model.AvailableShot.ToString(); this.UpdateProperty(infoText); break; } } } }
public void Update(Observable from, CameraEvent e) { CameraModel model = (CameraModel)from; CameraEvent.Type eventType = CameraEvent.Type.NONE; if ((eventType = e.GetEventType()) == CameraEvent.Type.PROPERTY_CHANGED || eventType == CameraEvent.Type.PROPERTY_DESC_CHANGED) { uint propertyID = (uint)e.GetArg(); if (propertyID == EDSDKLib.EDSDK.PropID_WhiteBalance) { uint property = (uint)model.WhiteBalance; //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: this.UpdateProperty(property); break; case CameraEvent.Type.PROPERTY_DESC_CHANGED: _desc = model.WhiteBalanceDesc; this.UpdatePropertyDesc(ref _desc); this.UpdateProperty(property); break; } } else if (propertyID == EDSDKLib.EDSDK.PropID_Evf_ClickWBCoeffs) { //Update property switch (eventType) { case CameraEvent.Type.PROPERTY_CHANGED: int size; EDSDKLib.EDSDK.EdsDataType datatype; uint err = EDSDKLib.EDSDK.EdsGetPropertySize(model.Camera, EDSDKLib.EDSDK.PropID_Evf_ClickWBCoeffs, 0, out datatype, out size); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { return; } //Get the WB coefficient EDSDKLib.EDSDK.EdsManualWBData wbCoefs = new EDSDKLib.EDSDK.EdsManualWBData(); IntPtr ptr = Marshal.AllocHGlobal(size); err = EDSDKLib.EDSDK.EdsGetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_Evf_ClickWBCoeffs, 0, size, ptr); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { Marshal.FreeHGlobal(ptr); return; } //Set the WB coefficient converted to the manual white balance data structure to manual white balance. wbCoefs = EDSDKLib.EDSDK.MarshalPtrToManualWBData(ptr); byte[] mwb = EDSDKLib.EDSDK.ConvertMWB(wbCoefs); err = EDSDKLib.EDSDK.EdsSetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_ManualWhiteBalanceData, 0, mwb.Length, mwb); if (err != EDSDKLib.EDSDK.EDS_ERR_OK) { Marshal.FreeHGlobal(ptr); return; } //Change the camera's white balance setting to manual white balance. err = EDSDKLib.EDSDK.EdsSetPropertyData(model.Camera, EDSDKLib.EDSDK.PropID_WhiteBalance, 0, sizeof(uint), 6); Marshal.FreeHGlobal(ptr); break; } } } }
private void Update(CameraEvent e) { if (this.InvokeRequired) { //The update processing can be executed from another thread. this.Invoke(new _Update(Update), new object[] { e }); return; } CameraEvent.Type eventType = e.GetEventType(); switch (eventType) { case CameraEvent.Type.DOWNLOAD_START: _max = (int)e.GetArg(); _val = 0; frmProgress.progressBar1.Maximum = _max; frmProgress.progressBar1.Value = _val; frmProgress.label2.Text = "File Downloading ..."; _controller.GetModel()._ExecuteStatus = CameraModel.Status.DOWNLOADING; frmProgress.label1.Text = _val.ToString() + " / " + _max.ToString(); break; case CameraEvent.Type.DELETE_START: _max = (int)e.GetArg(); _val = 0; frmProgress.progressBar1.Maximum = _max; frmProgress.progressBar1.Value = _val; frmProgress.label2.Text = "File Deleting ..."; _controller.GetModel()._ExecuteStatus = CameraModel.Status.DELETEING; frmProgress.label1.Text = _val.ToString() + " / " + _max.ToString(); break; case CameraEvent.Type.PROGRESS_REPORT: _val++; frmProgress.progressBar1.Value = _val; frmProgress.progressBar1.Invalidate(); frmProgress.label1.Text = _val.ToString() + " / " + _max.ToString(); break; case CameraEvent.Type.DOWNLOAD_COMPLETE: case CameraEvent.Type.DELETE_COMPLETE: // Proceed the last progress. frmProgress.Refresh(); System.Threading.Thread.Sleep(500); // Close progress . frmProgress.Close(); frmProgress.Dispose(); _controller.GetModel()._ExecuteStatus = (int)CameraModel.Status.NONE; break; case CameraEvent.Type.SHUT_DOWN: CameraModel cameramodel = _controller.GetModel(); cameramodel._ExecuteStatus = CameraModel.Status.CANCELING; frmProgress.label2.Text = "Canceling ..."; frmProgress.Invalidate(); break; default: break; } }
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; } }
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; } }