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();
            }
        }