void connection_DataReceived(object sender, ConnectionEventArgs e) { // we're using invoke, since it looks like this event // will be triggered from another thread textBox1.Invoke( new EventHandler( delegate { textBox1.Text += e.Message; })); }
void connection_DataReceived(object sender, ConnectionEventArgs e) { string message = e.Message; if (message.StartsWith("1-")) { message = message.Remove(0, 2); this.verdieping = Convert.ToInt32(message); } }
private void RenesSerialDataReceived(object sender, SerialDataReceivedEventArgs e) { ConnectionEventArgs args = new ConnectionEventArgs(sPort.ReadExisting().Replace("\n", "\r\n")); DataReceived(this, args); }