Exemplo n.º 1
0
 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;
     }
 }