public void StartListening() { _listeningTask = Task.Run(async() => { while (!_cancelationTokenSource.IsCancellationRequested) { try { await _dataReader.LoadAsync(1); var b = _dataReader.ReadByte(); _dataRead.Add(b); } catch (Exception ex) { Debug.WriteLine(ex.Message); ReadingErrorOccured?.Invoke(this, ex.Message); } } }); }
private void HandleErrorReceived(SerialDevice sender, ErrorReceivedEventArgs args) { ReadingErrorOccured?.Invoke(this, $"Error received: {args.Error}"); }