Quantcast
Channel: wpfcap Forum Rss Feed
Viewing all articles
Browse latest Browse all 21

New Post: Problems trying to stop and dispose camera

$
0
0
I tried many way, so i find this way to Stop my Webcam Device. But i can't understand how it can do :)
Anyone can show me why?

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
        if (webcamPlayer != null && webcamPlayer.Device != null)
        {
            webcamPlayer.Device.Stop();
            webcamPlayer.Device.Dispose();

            CommandBindings.Remove(new CommandBinding(Input.CaptureImageCommands.CaptureImage,
            new ExecutedRoutedEventHandler(CaptureImage_Executed), new CanExecuteRoutedEventHandler(CaptureImage_CanExecute)));
            CommandBindings.Remove(new CommandBinding(Input.CaptureImageCommands.RemoveImage,
                new ExecutedRoutedEventHandler(RemoveImage_Executed)));
            CommandBindings.Remove(new CommandBinding(Input.CaptureImageCommands.ClearAllImages,
                new ExecutedRoutedEventHandler(ClearAllImages_Executed)));

            SelectedImages.Clear();
            BitmapSource bitmap = webcamPlayer.CurrentBitmap;
            if (bitmap != null)
            {
                SelectedImages.Remove(bitmap);
            }
            //SelectedWebcamMonikerString =  "";
        }
    }

Viewing all articles
Browse latest Browse all 21

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>