public void Disconnect() { LogMessage("Disconnecting"); ThrowWhenNotConnected(); try { TxtCommunication.CloseConnection(); Connection = ConnectionStatus.NotConnected; } catch (Exception e) { LogMessage($"Exception while disconnecting: {e.Message}"); Connection = ConnectionStatus.Invalid; HandleException(e); } _disconnected?.Invoke(this, new EventArgs()); TxtCommunication.Dispose(); TxtCommunication = null; TxtCamera.Dispose(); TxtCamera = null; LogMessage("Disconnected"); _masterInterface.ResetValues(); }
public void Dispose() { Connection = ConnectionStatus.NotConnected; if (TxtCommunication != null) { TxtCommunication.Dispose(); TxtCommunication = null; } if (TxtCamera != null) { TxtCamera.Dispose(); TxtCamera = null; } _masterInterface.ResetValues(); }