public void CloseDevice() { if (InputDevice != null) { InputDevice.Stop(); InputDevice.Close(); InputDevice = null; } if (OutputDevice != null) { OutputDevice.Close(); OutputDevice = null; } Connected = false; }