protected async override void OnAppearing() { base.OnAppearing(); allData = await activityDataManager.GetActivityDataAsync(); var current = allData.Where(data => data.date.Year == DateTime.Now.Year && data.date.Month == DateTime.Now.Month && data.date.Day == DateTime.Now.Day); var number = current.Count(); if (number >= 1) { var t = current.ElementAt(0); kmLabel.Text = t.walkedkm.ToString("0.00"); System.Diagnostics.Debug.WriteLine("km: " + t.walkedkm); stepsLabel.Text = t.steps.ToString(); floorLabel.Text = t.climbedFloor.ToString(); } if (allData.Count > 1) { setChart(); } else { Chart4.Chart = new BarChart() { Entries = entries }; } }
async public void SetActivity() { var _data = await activityDataManager.GetActivityDataAsync(); var current = _data.Where(data => data.date.Year == DateTime.Now.Year && data.date.Month == DateTime.Now.Month && data.date.Day == DateTime.Now.Day); var nums = current.Count(); if (nums > 0) { var t = current.ElementAt(0); kmLabel.Text = t.walkedkm.ToString("0.00") + " km"; //System.Diagnostics.Debug.WriteLine("km: " + t.walkedkm); stepLabel.Text = t.steps.ToString() + " Steps"; } }