private void btnStartStop_Click(object sender, EventArgs e) { if (_capture == null) { SetupCapture(); } if (_capture != null) { if (CameraCaptureInProgress) { //stop the capture btnStartStop.Text = "Start Capture"; _capture.Dispose(); _capture = null; } else { btnStartStop.Text = "Stop"; _capture.Start(); toolStripLabelSettings.Text = _capture.GetCaptureProperties().ToString(); } CameraCaptureInProgress = !CameraCaptureInProgress; } }
/// <summary> /// So we can replace with a new framerate /// </summary> public void UpdateCaptureGrabber(ICaptureGrab captureGrabber) { if (CameraCapture != null) { CameraCapture.ImageGrabbed -= InternalImageGrabbedHandler; CameraCapture.Stop(); } CameraCapture = captureGrabber; CameraCapture.ImageGrabbed += InternalImageGrabbedHandler; if (Started) { CameraCapture.Start(); } }