// Closes the camera object and handles exceptions. private void DestroyCamera() { // Disable all parameter controls. try { if (camera != null) { testImageControl.Parameter = null; pixelFormatControl.Parameter = null; widthSliderControl.Parameter = null; heightSliderControl.Parameter = null; gainSliderControl.Parameter = null; exposureTimeSliderControl.Parameter = null; } } catch (Exception exception) { ShowException(exception); } // Destroy the camera object. try { if (camera != null) { camera.Close(); camera.Dispose(); camera = null; } } catch (Exception exception) { ShowException(exception); } // Destroy the converter object. if (converter != null) { converter.Dispose(); converter = null; } }
private void DestroyCamera() { try { if (camera != null) { camera.StreamGrabber.Stop(); EnParamAll = false; Param = null; } } catch (Exception e) { Log.Set(string.Format("Exception: {0}", e.Message)); } // Destroy the camera object. try { if (camera != null) { camera.Close(); camera.Dispose(); camera = null; } } catch (Exception e) { Log.Set(string.Format("Exception: {0}", e.Message)); } // Destroy the converter object. if (converter != null) { converter.Dispose(); converter = null; } }