private void TakePicture_Load(object sender, EventArgs e) { // Make sure there is a persisted camera. if (String.IsNullOrEmpty(_mainForm._settings.SelectedCameraDisplayName)) { MessageBox.Show("Error: No camera name has been saved. " + "Select one with the command line '/config' option.", "No camera name saved"); return; } // Select the persisted camera from the available ones. bool foundCamera = false; foreach (Camera cam in _webCam.GetCameras()) { if (cam.Name == _mainForm._settings.SelectedCameraDisplayName) { _webCam.SetCamera(cam); foundCamera = true; break; } } // Return error if couldn't find one. if (!foundCamera) { MessageBox.Show("Could not find camera: " + _mainForm._settings.SelectedCameraDisplayName, "Camera not found"); return; } _webCam.Stop(); // Enable GUI events now that all is set up. _webCam.Start(); _webCam.FlipImageHorizontally(_mainForm._settings.FlipImageHorizontally); }
/// <summary> /// Start streaming from WebCam. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, EventArgs e) { _webCam.Start(); _webCam.FlipImageHorizontally(_mainForm._settings.FlipImageHorizontally); }