protected override void Dispose(bool disposing) { if (disposing) { mRunning = false; if (mStopEvent != null) { mStopEvent.Set(); } // Shut down thread if (mThread != null) { mThread.Join(10000); mThread = null; } if (mDeviceEvent != null) { mDeviceEvent.Dispose(); } mDeviceEvent = null; if (mStopEvent != null) { mStopEvent.Dispose(); } mStopEvent = null; if (mBluetooth != null) { mBluetooth.Dispose(); } mBluetooth = null; } base.Dispose(disposing); }