public void Dispose() { if (_handle != null) { _handle.Dispose(); _handle = null; } }
private void OnDisconnected() { try { _disconnecting = true; IsConnected = false; if (_deviceInterfaceFile != null) { _deviceInterfaceFile.Dispose(); _deviceInterfaceFile = null; Thread.Sleep(500); } if (Disconnected != null) { Disconnected(this, new EventArgs()); } } finally { _disconnecting = false; } }