Does SerialDataReceivedEventHandler can be used in SerialPort Communication For Windows Service

StackOverflow https://stackoverflow.com/questions/22145986

Pergunta

I have a working windows form application which is able to read data from Serial Port.Now as per my requirement I have to convert it into Windows Service.In my Windows Form Application I used port1.DataReceived += new SerialDataReceivedEventHandler(port1_DataReceived); to get data from serial port.

Now as per my requirement i have a question Can I use SerialDataReceivedEventHandler in windows Service also to get data from serial port. Here is my code ..

port1.DataReceived += new SerialDataReceivedEventHandler(port1_Data);

Is it the right way to call port1_Data method which reads data from serial port..

Please help me.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top