private void USBHostController_DeviceDisconnectedEvent(USBH_Device device) { try { if (device.TYPE == USBH_DeviceType.Webcamera) { _cameraStatus = CameraStatus.Disconnected; _runThread = false; _TakePictureFlag = false; this._camera.StopStreaming(); _camera = null; DebugPrint("Camera disconnected."); } } catch { } if (device.TYPE == USBH_DeviceType.Webcamera) { OnCameraDisconnectedEvent(this); } }
private void USBHostController_DeviceConnectedEvent(USBH_Device device) { try { if (device.TYPE == USBH_DeviceType.Webcamera) { _camera = new USBH_Webcam(device); this._cameraThread = new Thread(CameraCommunication); _runThread = true; this._cameraThread.Start(); this._cameraStatus = CameraStatus.Ready; DebugPrint("Camera connected."); } } catch { } if (device.TYPE == USBH_DeviceType.Webcamera) { CameraConnectedEvent(this); } }