private void OnStopRecord(object sender, EventArgs e) { int err; err = PCO_SDK_LibWrapper.PCO_SetRecordingState(f_CameraHandle, 0); cbGrabCamera.IsEnabled = false; if (camDialog != IntPtr.Zero) { PCO_SDK_LibWrapper.PCO_EnableDialogCam(camDialog, true); } err = PCO_SDK_LibWrapper.PCO_CancelImages(f_CameraHandle); f_CameraTimer.Stop(); }
private void ConnectToCamera(object sender, RoutedEventArgs e) { const ushort boardNum = 1; f_CameraHandle = IntPtr.Zero; f_ConvertHandle = IntPtr.Zero; convertDialog = IntPtr.Zero; camDialog = IntPtr.Zero; bufwidth = 0; bufheight = 0; // Verify board number validity // Open a handle to the camera try { var err = PCO_SDK_LibWrapper.PCO_OpenCamera(ref f_CameraHandle, boardNum); if (err == 0) { ushort wrecState = 0; cbStartCamera.IsEnabled = false; cbStopCamera.IsEnabled = false; cbGetDescription.IsEnabled = true; cbOpenCamera.IsEnabled = false; cbCloseCamera.IsEnabled = true; PCO_SDK_LibWrapper.PCO_GetRecordingState(f_CameraHandle, ref wrecState); if (wrecState != 0) { PCO_SDK_LibWrapper.PCO_SetRecordingState(f_CameraHandle, 0); } // buttonOpenCamDialog.Enabled = true; } else { err = PCO_SDK_LibWrapper.PCO_ResetLib(); } } catch (Exception ex) { LogBox.Items.Insert(0, new LogBoxItem { Dt = DateTime.Now, LogText = $"Ошибка соединения с камерой {ex}" }); } }
private void OnStartRecord(object sender, EventArgs e) { int err; uint dwWarn = 0, dwError = 0, dwStatus = 0; ushort width = 0; ushort height = 0; ushort widthmax = 0; ushort heightmax = 0; // It is recommended to call this function in order to get information about the camera internal state err = PCO_SDK_LibWrapper.PCO_GetCameraHealthStatus(f_CameraHandle, ref dwWarn, ref dwError, ref dwStatus); PCO_SDK_LibWrapper.PCO_SetTriggerMode(f_CameraHandle, 0); err = PCO_SDK_LibWrapper.PCO_ArmCamera(f_CameraHandle); err = PCO_SDK_LibWrapper.PCO_GetSizes(f_CameraHandle, ref width, ref height, ref widthmax, ref heightmax); err = PCO_SDK_LibWrapper.PCO_CamLinkSetImageParameters(f_CameraHandle, (UInt16)width, (UInt16)height); err = PCO_SDK_LibWrapper.PCO_SetRecordingState(f_CameraHandle, 1); cbGrabCamera.IsEnabled = true; if (camDialog != IntPtr.Zero) { PCO_SDK_LibWrapper.PCO_EnableDialogCam(camDialog, false); } f_CameraTimer.Start(); }