private void UpdateData() { if (!(Selected_MaxDate >= Selected_MinDate)) { DependencyService.Get <IMessage>().ShortAlert("Date Non Valide"); return; } Weight_Data.Clear(); Min = null; Max = null; IMC = 0; foreach (var item in DataStore.GetWeightAsync().Where(i => i.Date.Date >= Selected_MinDate & i.Date.Date <= Selected_MaxDate)) { Weight_Data.Add(WeightConverter.Convert(item, Settings.WeightUnit)); } if (Weight_Data.Count > 0) { Weight_Data = new ObservableCollection <Weight_Model>(Weight_Data.OrderBy(i => i.Date)); Min = Weight_Data.OrderBy(i => i.Weight).First(); Max = Weight_Data.OrderBy(i => i.Weight).Last(); MaximumChart = Convert.ToInt32(Max.Weight + 100); IMC = Math.Round(WeightConverter.DoubleWeightConvetBack(Weight_Data.OrderBy(i => i.Date).Last().Weight, Settings.WeightUnit) / Math.Pow(Profil.Height / 100, 2), 1); if (string.IsNullOrWhiteSpace(Message)) { Message = Resources["Last"] + " " + Resources["Weight_Label"] + " : " + Weight_Data.Last().Weight + " " + Settings.WeightUnit; } } if (IMC < 18.5) { GlucoseColor = Color.FromHex("#f1c40f"); } if (IMC >= 18.5 & IMC <= 25) { GlucoseColor = Color.FromHex("#2ecc71"); } if (IMC > 25) { GlucoseColor = Color.FromHex("#e74c3c"); } }