public bool Stop() { if (cam != null && cam.IsRunning) { cam?.Stop(); } return(true); }
/// <summary> /// 摄像头关闭方法 /// </summary> public void Close() { if (cam.IsRunning) { cam.Stop(); isOpen = false; } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { #if REMOTE_CAMERA remoteSource.Stop(); #else localSource.Stop(); #endif }
private void btn_def_resolution_Click(object sender, EventArgs e) { int index_resolution = comboBox2.SelectedIndex; videoSource.Stop(); videoSource.VideoResolution = videoSource.VideoCapabilities[index_resolution]; videoSource.Start(); }
public void StopVideoPreview() { if (LocalWebCam != null) { LocalWebCam.NewFrame -= Cam_NewFrame; LocalWebCam.Stop(); } }
/// <summary> /// Executed when video input was changed. /// Sets the video input and show the possible video resolutions in the next combobox. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBoxVideoInput_SelectedIndexChanged(object sender, SelectionChangedEventArgs e) { this.btnStartStop.IsEnabled = false; this.btnStartStop.Content = "Start"; if (device != null) { device.Stop(); } device = new VideoCaptureDevice(this.videoDevices[this.comboBoxVideoInput.SelectedIndex].MonikerString); device.NewFrame += new NewFrameEventHandler(video_NewFrame); capabilities = device.VideoCapabilities; comboBoxResolution.Items.Clear(); foreach (VideoCapabilities capability in capabilities) { this.comboBoxResolution.Items.Add(capability.FrameSize.Width + " X " + capability.FrameSize.Height + " (" + capability.AverageFrameRate + " fps)"); } }
void StopCam() { if (webCam != null && webCam.IsRunning) { webCam.NewFrame -= WebCam_NewFrame; webCam.Stop(); } }
public static void stop() { device.SignalToStop(); if (device.IsRunning) { device.Stop(); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (videoCaptureDevice != null && videoCaptureDevice.IsRunning) { dt_qr.Stop(); videoCaptureDevice.Stop(); } }
public void fotografCek(PictureBox picturebox) { if (cam.IsRunning == true) { cam.Stop(); picturebox.Image = picturebox.Image; } }
private void CloseTheCam() { if (vcd.IsRunning) { vcd.Stop(); a = true; } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //när applikationen stängs så avaktiveras capturedevice(kameran) if (CaptureDevice.IsRunning == true) { CaptureDevice.Stop(); } }
private void Stop_Click(object sender, EventArgs e) { if (videoSource.IsRunning == true) { videoSource.Stop(); } Application.Exit(null); }
protected override void OnFormClosed(FormClosedEventArgs e) { if (videoSource.IsRunning) { videoSource.Stop(); } base.OnFormClosed(e); }
private void BtnExit_Click(object sender, EventArgs e) { if (cam.IsRunning) { cam.Stop(); } this.Close(); }
private void StopCamera() { if (SelectedCam != null) { SelectedCam.SignalToStop(); SelectedCam.Stop(); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //停摄像头 Camera.Stop(); //关闭录像文件,如果忘了不关闭,将会得到一个损坏的文件,无法播放 VideoOutPut.Close(); }
//---按钮被单击事件 private void startBtn_Click(object sender, EventArgs e) { try { if (startBtn.Text == "开始") { ///-- startBtn.Text = "停止"; if (rbH.Checked) { cam.VideoResolution = cam.VideoCapabilities[0]; } else if (rbM.Checked) { cam.VideoResolution = cam.VideoCapabilities[1]; } else { cam.VideoResolution = cam.VideoCapabilities[2]; } ///---启动摄像头 cam.Start(); timer1.Start(); if (detector != null) { detector.Reset(); } detected = false; detectedCount = 0; btnRecord.Enabled = true; } else { ///--设置按钮提示字样 startBtn.Text = "开始"; ///--停止摄像头捕获图像 cam.Stop(); timer1.Stop(); btnRecord.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Dispose() { if (_source != null) { _source.Stop(); } _source = null; }
private void Form2_FormClosed(object sender, FormClosedEventArgs e) { aTimer.Stop(); aTimer.Dispose(); camera.Stop(); //temp.Close(); Application.Exit(); }
public void stop() { pause(); lock (thisLock) { cam.Stop(); } }
//cuando le damos al boton de hacer una foto private void tomarFoto_Click(object sender, RoutedEventArgs e) { if (cam.IsRunning) { filePath = @"C:\Users\Portatil\Documents\GitHub\EscuelaMusica\EscuelaSanJuan\imagenesPersonas\"; cam.Stop(); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (device.IsRunning) { Application.Exit(); device.Stop(); } }
private void ExitButton_Click(object sender, EventArgs e) { _senderTextUDPClient.Dispose(); _senderVideoUDPClient.Dispose(); if (_receiverVideoUDPClient != null) { _receiverVideoUDPClient.Dispose(); _receiverTextUDPClient.Dispose(); } if (_videoSource.IsRunning) { _videoSource.Stop(); } Application.Exit(); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// void ConnectLocalCamera(int pictureIndex) { if (pictureIndex == 1) { if (cbWebcam1.Items.Count == 0 || cbWebcam1.SelectedIndex == -1) { return; } } else { if (cbWebcam2.Items.Count == 0 || cbWebcam2.SelectedIndex == -1) { return; } } if (m_videoSource != null) { m_videoSource.Stop(); } else { FilterInfoCollection videosources = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (pictureIndex == 1) { m_videoSource = new VideoCaptureDevice(videosources[cbWebcam1.SelectedIndex].MonikerString); } else { m_videoSource = new VideoCaptureDevice(videosources[cbWebcam2.SelectedIndex].MonikerString); } } m_videoSource.NewFrame += new NewFrameEventHandler(OnCameraFrame); m_videoSource.Start(); if (pictureIndex == 1) { btnSnapshot1.Visibility = Visibility.Visible; } else { btnSnapshot2.Visibility = Visibility.Visible; } }
private void ShareScreenBt_Click(object sender, RoutedEventArgs e) { videoSource.Stop(); videoSource.SignalToStop(); ShareScreenBt.IsEnabled = false; ShareButtonBt.IsEnabled = true; LoadSceenCapture(); }
private void btn_dur_Click(object sender, EventArgs e) { //DURDUR BUTONU if (kamera.IsRunning) //kamera açıksa kapatıyoruz. { kamera.Stop(); } }
private void stopCamera() { if (videoSource != null) { videoSource.SignalToStop(); videoSource.Stop(); } }
private void button2_Click(object sender, EventArgs e) { if (Finalvideo.IsRunning) { Finalvideo.Stop(); } Application.Exit(); }
private void button2_Click(object sender, EventArgs e) { if (cam.IsRunning) { cam.Stop(); // Kamerayı durduruyoruz. } }