void UART_DataReceived(object sender, SerialDataReceivedEventArgs e) { _dataInLora = UART.Deserialize(); for (int index = 0; index < _dataInLora.Length; index++) { rx = _dataInLora[index]; //if error if (_dataInLora[index].Length > 5) { //if receive data if (rx.Substring(0, 6) == "mac_rx") { string hex = _dataInLora[index].Substring(9); //update display txtMessage.Text = hex;//Unpack(hex); txtMessage.Invalidate(); window.Invalidate(); byte[] data = StringToByteArrayFastest(hex); string decoded = new String(UTF8Encoding.UTF8.GetChars(data)); Debug.Print("decoded:" + decoded); } } } Debug.Print(rx); }