private async void Instance_ValueChangeCompleted(HeartRateMeasurement heartRateMeasurementValue) { if (heartRateMeasurementValue.HasExpendedEnergy) { // Serialize UI update to the the main UI thread. await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { ExpendedEnergyTextBlock.Text = "Expended Energy: " + heartRateMeasurementValue.ExpendedEnergy + " kJ"; }); } }
private async void Instance_ValueChangeCompleted(HeartRateMeasurement heartRateMeasurementValue) { // Serialize UI update to the the main UI thread. await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { statusTextBlock.Text = "Latest received heart rate measurement: " + heartRateMeasurementValue.HeartRateValue; outputDataChart.PlotChart(HeartRateService.Instance.DataPoints); outputListBox.Items.Insert(0, heartRateMeasurementValue); }); }
public void PlotChart(HeartRateMeasurement[] data) { // First set the data points that we are going to render // The functions will use this data to plot the chart dataSet = data; // Remove previous rendering this.Children.Clear(); CreateRenderingOptions(); // Preprocess the data for rendering FillOffsetList(); // Render the actual chart in natural Z order DrawBackground(); DrawYAxis(); DrawChart(); }