CatenaLogic.Windows.Presentation.WebcamPlayer.CapDevice.Stop C# (CSharp) Method

Stop() public method

Stops grabbing images from the capture device
public Stop ( ) : void
return void
        public void Stop()
        {
            try
            {
                // Check if the capture device is even running
                if (IsRunning)
                {
                    // Yes, stop via the event
                    StopSignal.Set();

                    // Abort the thread
                    Worker.Abort();
                    if (Worker != null)
                    {
                        // Join
                        Worker.Join();

                        // Release
                        Release();
                    }
                }
            }
            catch (Exception ex)
            {
                // Trace
                Trace.TraceError(ex.Message);

                // Release
                Release();
            }
        }

Usage Example

Example #1
0
        /// <summary>
        /// Cleans up a specific device
        /// </summary>
        /// <param name="device">Device to clean up</param>
        void CleanUpDevice(CapDevice device)
        {
            // Check if there even is a device
            if (device == null)
            {
                return;
            }

            // Stop
            device.Stop();

            // Unsubscribe
            device.NewBitmapReady -= device_OnNewBitmapReady;
        }
All Usage Examples Of CatenaLogic.Windows.Presentation.WebcamPlayer.CapDevice::Stop