AForge.Video.Ximea.XimeaCamera.Close C# (CSharp) Метод

Close() публичный Метод

Close opened camera (if any) and release allocated resources.

The method also calls StopAcquisition method if it was not done by user.

An error occurred while communicating with a camera. See error /// message for additional information.
public Close ( ) : void
Результат void
        public void Close( )
        {
            lock ( sync )
            {
                if ( deviceHandle != IntPtr.Zero )
                {
                    if ( isAcquisitionStarted )
                    {
                        try
                        {
                            StopAcquisition( );
                        }
                        catch
                        {
                        }
                    }

                    try
                    {
                        int errorCode = XimeaAPI.xiCloseDevice( deviceHandle );
                        HandleError( errorCode );
                    }
                    finally
                    {
                        deviceHandle = IntPtr.Zero;
                    }
                }
            }
        }

Usage Example

Пример #1
0
        // Free resources
        private void Free()
        {
            lock (sync)
            {
                thread = null;

                // release events
                if (stopEvent != null)
                {
                    stopEvent.Close();
                    stopEvent = null;
                }

                camera.Close();
            }
        }