private async void CommunicationListener() { while (true) { var commandReceived = await SerialCommunicationHelper.ReadBytes(serialDevice); try { ParseCommand(commandReceived); } catch (Exception ex) { DiagnosticInfo.Display(null, ex.Message); } } }
private async void CommunicationListener() { const int msSleepTime = 50; while (true) { var commandReceived = await SerialCommunicationHelper.ReadBytes(streamSocket.InputStream); try { if (commandReceived.Length > 0) { ParseCommand(commandReceived); } } catch (Exception ex) { DiagnosticInfo.Display(null, ex.Message); } Task.Delay(msSleepTime).Wait(); } }