private void btnStart_Click(object sender, EventArgs e) { if (videoSource == null) { var vcd = new VideoCaptureDevice(videoDevicesList[cmbVideoSource.SelectedIndex].MonikerString); vcd.VideoResolution = vcd.VideoCapabilities[resolutionsBox.SelectedIndex]; Debug.WriteLine(vcd.VideoCapabilities[1].FrameSize.ToString()); Debug.WriteLine(resolutionsBox.SelectedIndex); videoSource = vcd; videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); StartButton.Text = "Стоп"; controlPanel.Enabled = true; cmbVideoSource.Enabled = false; } else { videoSource.SignalToStop(); if (videoSource != null && videoSource.IsRunning && originalImageBox.Image != null) { originalImageBox.Image.Dispose(); } videoSource = null; StartButton.Text = "Старт"; controlPanel.Enabled = false; cmbVideoSource.Enabled = true; } }
//Defines actions,happening after closing the form: Stops the camera private void Form1_Closing(object sender, CancelEventArgs e) { if (videoSource != null && videoSource.IsRunning) { videoSource.SignalToStop(); } }
public void StopCamera_Old() { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= new NewFrameEventHandler(video_NewFrame); } }
private void button2_Click(object sender, EventArgs e) { videoSource.SignalToStop(); if (videoSource != null && videoSource.IsRunning && pictureBox1.Image != null) { pictureBox1.BackgroundImage.Dispose(); } }
private void frmUser_Closing(object sender, CancelEventArgs e) { // signal to stop if (videoSource != null && videoSource.IsRunning) { videoSource.SignalToStop(); } }
private void StopCamera() { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= video_NewFrame; } Image = null; }
private void Form1_Closing(object sender, CancelEventArgs e) { // signal to stop //ClosingConnections(); if (videoSource != null && videoSource.IsRunning) { videoSource.SignalToStop(); } }
public void StopCamera(System.Windows.Controls.Image image) { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= new NewFrameEventHandler((sender, args) => { video_NewFrame(sender, args, image); }); } image.Dispatcher.Invoke(() => image.Source = null); }
private void StopCamera() { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= video_NewFrame; } _isCameraStart = false; _logger.Info($"Stop camera | {DateTime.Now}"); GC.Collect(); }
public virtual void StopRecording() { _recording = false; if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= VideoNewFrame; } StopVideoFileWriter(); }
/// <summary> /// Decodes the QR tag and completes the order /// </summary> private void decode_QRtag() { try { Bitmap bitmap = new Bitmap(pbCamera.Image); BarcodeReader reader = new BarcodeReader { AutoRotate = true, TryHarder = true }; Result result = reader.Decode(bitmap); string decoded = result.ToString().Trim(); long ticketId = Convert.ToInt64(decoded); ticket = rClient.GetTicket(ticketId); timer1.Stop(); videoSource.SignalToStop(); pbCamera.Image = null; btnStopCamera.Enabled = false; btnStopCamera.Visible = false; if (!ticket.CheckedIn) { lblErrorMessage.Text = "Ticked is not checked in!"; errorTimer.Start(); } else if (ticket.CheckedOut) { lblErrorMessage.Text = "Ticked is checked out!"; errorTimer.Start(); } else if (ticket.Balance >= CalculatePrice(order)) //if ticket is valid we check its balance. { foreach (Product p in order) { for (int i = 0; i < p.NrInOrder; i++) { rClient.BuyProduct(ticketId, p.Id); } } MessageBox.Show("Purchase successful."); } else { lblErrorMessage.Text = "Not enough balance."; errorTimer.Start(); } ClearOrder(); }//webexception required for when the server throws an error. catch (WebException) { StopCamera(); ClearOrder(); lblErrorMessage.Text = "Ticket not found!"; errorTimer.Start(); } catch { } }
private void StopCamera() { _recording = false; _writer.Close(); _writer.Dispose(); if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= video_NewFrame; } Image = null; }
private void Form1_Closing(object sender, CancelEventArgs e) { updateTmr.Dispose(); updateTmr = null; // Как-то надо ещё робота подождать, если он работает if (videoSource != null && videoSource.IsRunning) { videoSource.SignalToStop(); } // Тут ошибка вылетает! Надо дождаться все ассоциированные процессы }
/// <summary> /// Stops the video stream. /// </summary> /// <remarks></remarks> public void Stop() { if (Source != null && Source.IsRunning) { Source.SignalToStop(); } }
private void btnCheckReservation_Click(object sender, EventArgs e) { HidePictures(); if (videoSource != null && videoSource.IsRunning) // click twice = turn off camera { videoSource.SignalToStop(); pbCamera.Image = null; btnCheckInTicket.Text = "Click to scan ticket"; } else { btnCheckInTicket.Text = "Stop scanning"; videoSource.Start(); timer1.Start(); } }
public void StopBroadcastImage() { _videoSource.SignalToStop(); _videoSource.NewFrame -= Video_NewFrame; _videoSource.VideoSourceError -= VideoStream_VideoSourceError; // _mainWindow.Pic.Source = null; }
// Signal video source to stop public void signalToStop() { if (_videoSource != null) { _videoSource.SignalToStop(); } }
public void Dispose() { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); } }
// Siganl video source to stop public void SignalToStop( ) { if (videoSource != null) { videoSource.SignalToStop( ); } }
public void StopCamera(bool localCam = true) { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= video_NewFrame; } if (localCam) { ImageLocal.Dispatcher.Invoke(() => ImageLocal.Source = null); } else if (IsWebCamLive) { ImageLive.Dispatcher.Invoke(() => ImageLive.Source = null); } }
private void Form1_Closing(object sender, CancelEventArgs e) { if (zrodlo != null && zrodlo.IsRunning) { zrodlo.SignalToStop(); } }
private void Button_PauseFeeding_Click(object sender, RoutedEventArgs e) { if (videoSource != null) { videoSource.SignalToStop(); } }
void CloseOpenVideoSource() { if (videoSource == null) { videoSource = new VideoCaptureDevice(videoDevicesList[cmbVideoSource.SelectedIndex].MonikerString); videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame); videoSource.Start(); btnStart.Text = "Stop"; } else { videoSource.SignalToStop(); videoSource = null; btnStart.Text = "Start"; } }
private void StopCamera(object obj) { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= new NewFrameEventHandler(video_NewFrame); } }
/// <summary> /// Signal video source to stop. /// </summary> /// /// <remarks><para>Use <see cref="WaitForStop"/> method to wait until video source /// stops.</para></remarks> /// public void SignalToStop() { CheckForCrossThreadAccess(); requestedToStop = true; videoSource?.SignalToStop(); }
private void StopCamera() { if (videoSource != null && videoSource.IsRunning) { videoSource.SignalToStop(); videoSource.NewFrame -= new NewFrameEventHandler(videoSource_NewFrame); } }
public void SignalToStop() { CheckForCrossThreadAccess(); requestedToStop = true; if (videoSource != null) { videoSource.SignalToStop(); } }
/// <summary> /// Signal the video source to stop. /// </summary> /// public void SignalToStop() { requestedToStop = true; if (videoSource != null) { videoSource.SignalToStop(); } }
private void DecodeQr() { try { Bitmap map = new Bitmap(pbCamera.Image); BarcodeReader reader = new BarcodeReader { AutoRotate = true, TryHarder = true }; Result result = reader.Decode(map); string decoded = result.ToString().Trim(); timer1.Stop(); videoSource.SignalToStop(); CompleteCheckOut(decoded); button1.Text = "Click to scan ticket"; pbCamera.Image = null; } catch (WebException) { StopCamera(); lblErrorMessage.Text = "Ticket not found!"; timer2.Start(); } catch { } }
public void StopCamera() { if (_videoSource != null && _videoSource.IsRunning) { _videoSource.SignalToStop(); _videoSource.NewFrame -= video_NewFrame; } BitImage = null; _bitmap = null; }