private void disconnectBt_Click(object sender, EventArgs e) { try { stop(); _capture.Stop(); _webCamera.Stop(); _connector.Disconnect(_webCamera, _liveProvider); _connector.Disconnect(_webCamera, _capture); liveViewer.Stop(); _capture.Dispose(); connectBt.Enabled = true; disconnectBt.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Stops the video handlers. /// </summary> public void StopVideo() { if (WebCamera != null) { WebCamera.Stop(); } }
public override void Disconnect() { if (_camera != null) { _camera.Stop(); Connector.Disconnect(_camera, Detector); Connector.Disconnect(Detector, BitmapSourceProvider); Connector.Disconnect(_camera, Snapshot); _camera.Stop(); CameraState = "Disconnected"; Log.Write("USB camera disconnected"); base.Disconnect(); } }
private void DisconnectUSBCamera_Click(object sender, RoutedEventArgs e) { _videoViewerWpf.Stop(); _webCamera.Stop(); _webCamera.Dispose(); _connector.Disconnect(_webCamera, _provider); }
/// <summary> /// Stops the video handlers. /// </summary> public void StopVideo() { if (WebCamera != null) { WebCamera.Stop(); } if (videoCollection != null) { videoCollection.Stop(); } }
private async void comboBoxCamara_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxCamara.SelectedIndex == 1) { await SetVideoViewer(); } else if (comboBoxCamara.SelectedIndex == 2) { await SetVideoViewer(); } else { if (webCamera != null) { webCamera.Stop(); videoViewerWFRenderizador.Stop(); } } }
private void btnCaptureImg_Click(object sender, EventArgs e) { //string strPath; //strPath = Path.Combine(Application.StartupPath, @"VisitorImages"); //SaveFileDialog s = new SaveFileDialog(); ////s.FileName = "Image";// Default file name ////s.DefaultExt = ".Jpg";// Default file extension ////s.Filter = "Image (.jpg)|*.jpg"; // Filter files by extension //s.RestoreDirectory = true; //s.InitialDirectory = strPath; //if (!Directory.Exists(strPath)) //{ // Directory.CreateDirectory(strPath); //} //if (File.Exists(strPath + "\\" + objVisitorGP.ImgFileName)) //{ // File.Delete(strPath+ "\\" + objVisitorGP.ImgFileName); //} picVisitorImg.Image = picVideo.Image; //Helper.SaveImageCapture(picVisitorImg.Image, strPath + "\\" + objVisitorGP.ImgFileName); //use memorystream MemoryStream ms = new MemoryStream(); picVisitorImg.Image.Save(ms, ImageFormat.Jpeg); byte[] photo_aray = new byte[ms.Length]; ms.Position = 0; ms.Read(photo_aray, 0, photo_aray.Length); objVisitorGP.VisitorImage = photo_aray; //objVisitorGP.ImgFileName = "Image.jpg"; objWebCam.Stop(); // Camera Code Ends Here... ChangeCameraMode(true); SendKeys.Send("{TAB}"); }
private void FormClient_FormClosed(object sender, FormClosedEventArgs e) { try { if (camera != null) { camera.Stop(); } if (client != null) { client.Close(); } if (listen != null) { listen.Interrupt(); } } catch { } finally { Environment.Exit(0); } }
/// <summary> /// Helper method to disconnect webcam. /// </summary> private void DisconnectCamera() { _mediaConnector.Disconnect(_webCamera, _imageProvider); _webCamera.Stop(); _videoViewer.Stop(); }
/// <summary> /// Changes the camera device. /// </summary> public void ChangeCamera(int deviceID) { if (!initialized) { return; } // same device if (WebCamera != null && WebCamera.DeviceID == deviceID) { return; } // find the proper info VideoDeviceInfo newDeviceInfo = null; foreach (var info in Cameras) { if (info.DeviceID != deviceID) { continue; } newDeviceInfo = info; break; } if (newDeviceInfo == null) { return; } // begin change device bool capturing = false; if (WebCamera != null) { // disconnect if (LocalImageProvider != null) { audioConnector.Disconnect(WebCamera, LocalImageProvider); } audioConnector.Disconnect(WebCamera, phoneCallVideoSender); // dispose previous device capturing = WebCamera.Capturing; WebCamera.Stop(); WebCamera.Dispose(); } // create new WebCamera = WebCamera.GetDevice(newDeviceInfo); if (WebCamera != null) { audioConnector.Connect(WebCamera, LocalImageProvider); audioConnector.Connect(WebCamera, phoneCallVideoSender); if (capturing) { WebCamera.Start(); } } OnPropertyChanged("WebCamera"); }
public static void DisconnectUSBCamera() { timAnimation.Enabled = false; _videoViewer.Stop(); _webCamera.Stop(); }