void gpsComDevice_RawData(object sender, SerialDataArgs e) { if (InvokeRequired) { Invoke(new EventHandler<SerialDataArgs>(gpsComDevice_RawData), sender, e); return; } textBoxGPSData.AppendText(e.RawData); }
void gpsComDevice_NewCoordinatesRecieved(object sender, SerialDataArgs e) { if (InvokeRequired) { Invoke(new EventHandler<SerialDataArgs>(gpsComDevice_NewCoordinatesRecieved), sender, e); return; } var delta = Math.Max(Math.Abs(MainMap.Position.Lat - e.Location.Lat), Math.Abs(MainMap.Position.Lng - e.Location.Lng)); if (delta > 0.0001) { textBoxGPSData.AppendText("New chase position " + e.Location + Environment.NewLine); this.MainMap.Position = e.Location; } }