Пример #1
0
 private void DisconnectDisplay(ISerialPortService pObjSerialPort)
 {
     if (pObjSerialPort != null)
     {
         lock (pObjSerialPort)
         {
             if (Connections.Count == 0 && pObjSerialPort.IsOpen())
             {
                 LogService.WriteInfo(string.Format("Desconectando puerto serial {0}...", pObjSerialPort.GetName()));
                 pObjSerialPort.Close();
                 LogService.WriteInfo(string.Format("Puerto serial {0} desconectado.", pObjSerialPort.GetName()));
             }
         }
     }
 }
Пример #2
0
 private void ConnectDisplay(ISerialPortService pObjSerialPort)
 {
     if (pObjSerialPort != null)
     {
         LogService.WriteInfo("Puerto serial valido.");
         lock (pObjSerialPort)
         {
             if (!pObjSerialPort.IsOpen())
             {
                 LogService.WriteInfo(string.Format("Conectando puerto serial {0}...", pObjSerialPort.GetName()));
                 pObjSerialPort.Open();
                 LogService.WriteInfo(string.Format("Puerto serial {0} conectado.", pObjSerialPort.GetName()));
             }
         }
     }
 }