private void Disconnection(bool stopListen = true) { CheckDisposed(); DeviceDisconnecting?.Invoke(this); Disconnect(); client?.Close(); client?.Dispose(); if (stopListen) { StopListen(); } DeviceDisconnected?.Invoke(this); }
public void Disconnect() { if (ConnectedDevice == null) { return; } DeviceDisconnecting?.Invoke(this, EventArgs.Empty); ConnectedDevice.Dispose(); ConnectedDevice = null; DeviceDisconnected?.Invoke(this, EventArgs.Empty); }