Reading from serial port FEZ Cerbuino

I’d like to know if there is a way to receive strings or bytes through the Xbee module connected on FEZ CERBUINO, usually I’ve got comunication only sending bytes or “writing serial port” from the module configured as Router, i have no idea how to declare a serial port reading

Check out the SerialPort class.

 xBee.Configure(115200, GT.Interfaces.Serial.SerialParity.None,
            GT.Interfaces.Serial.SerialStopBits.One, 8);
            xBee.SerialLine.DataReceived += new GT.Interfaces.Serial.DataReceivedEventHandler(serial_DataReceived);

@ Tzu Hsuan -

Ive been reading some old post but i can not figure out how to receive, im newbie on c# and gadgeteer, here is my code

using System;
using System.IO.Ports;
using System.Text;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using System.Threading;
using Microsoft.SPOT.Hardware;
using GHI.OSHW.Hardware;
using Microsoft.SPOT;

namespace GadgeteerApp1
public partial class Program
bool state = true;

    SerialPort xbee = new SerialPort("COM1", 9600);
    static OutputPort LED1 = new OutputPort(FEZCerberus.Pin.PB13, false);  //D8
    void ProgramStarted()
        xbee.DataReceived += new SerialDataReceivedEventHandler(xbee_DataReceived);
        GT.Timer timer = new GT.Timer(500);
        timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);

    void xbee_DataReceived(object sender, SerialDataReceivedEventArgs e)
    void timer_Tick(GT.Timer timer)
        state = !state;
        byte[] buffer = Encoding.UTF8.GetBytes(DateTime.Now.ToString() + "\r\n");
        xbee.Write(buffer, 0, buffer.Length);


on void xbee_DataReceived(object sender, SerialDataReceivedEventArgs e) i think i have to declare the data received there, for example id know to active an output with a byte sended by arduino

 void serial_DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData data)
            var font = Resources.GetFont(Resources.FontResources.NinaB);
            int btr = xBee.SerialLine.BytesToRead;
            if (btr == 0) return;
            byte[] bytes = new byte[btr];
            xBee.SerialLine.Read(bytes, 0, btr);
            string Text = new string(System.Text.Encoding.UTF8.GetChars(bytes));                    
            display_T35.SimpleGraphics.DisplayText(Text.ToString(), font, GT.Color.White, 50, 200);