private void LiveUpdate(SimpleLineChart chart, MavlinkLog currentFlightLog, LogItemSchema schema)
{
// this method is running on a background task and it's job is to read an infinite stream of
// data values from the log and show them in the live scrolling chart.
CancellationTokenSource canceller = new CancellationTokenSource();
chart.Closed += (s,e) =>
{
canceller.Cancel();
};
var query = currentFlightLog.LiveQuery(schema, canceller.Token);
foreach (DataValue item in query)
{
if (item == null)
{
return;
}
chart.SetCurrentValue(item);
}
}