void OnApplicationQuit()
{
//If we have a data reader
if( reader != null )
{
//Dispose of it
reader.Dispose();
reader = null;
}
//If we have a sensor
if( sensor != null )
{
//If a connection is open, close it
if( sensor.IsOpen )
{
sensor.Close();
}
//Get rid of the reference
sensor = null;
}
}
}