public bool SetCurrentPortName(string portName) { var pName = AllowedPortNames.First(x => x == portName); CurrentPortName = pName; SerialPort?.Dispose(); return(InitSerialPortSender(pName, dataReceived)); }
public HardwareService(SerialDataReceivedEventHandler dataReceived) { this.dataReceived = dataReceived; CurrentPortName = AllowedPortNames.First(x => x == "COM6"); InitSerialPortSender(CurrentPortName, this.dataReceived); }