private void StopSerialCommunication() { _serialClient.CloseCom(); _serialClient.SerialDataReceived -= SerialDataReceived; _serialClient.Dispose(); InfinityService.Log.Info($"Serial Port {_viewModel.SerialPortNumber} Closed"); }
protected override void DisposeObject() { if (_serialClient != null) { _serialClient.Dispose(); } if (_captureClient != null) { _captureClient.Dispose(); } }
private void Disconnect() { if (m_serialClient != null) { // Unwire serial client events m_serialClient.Disconnect(); m_serialClient.ConnectionAttempt -= m_serialClient_ConnectionAttempt; m_serialClient.ConnectionEstablished -= m_serialClient_ConnectionEstablished; m_serialClient.ConnectionException -= m_serialClient_ConnectionException; m_serialClient.ConnectionTerminated -= m_serialClient_ConnectionTerminated; m_serialClient.ReceiveDataComplete -= m_serialClient_ReceiveDataComplete; m_serialClient.ReceiveDataException -= m_serialClient_ReceiveDataException; m_serialClient.SendDataComplete -= m_serialClient_SendDataComplete; m_serialClient.SendDataException -= m_serialClient_SendDataException; m_serialClient.Dispose(); m_serialClient = null; } }