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;
}
}
}
}
// Free resources private void Free() { lock (sync) { thread = null; // release events if (stopEvent != null) { stopEvent.Close(); stopEvent = null; } camera.Close(); } }