public void SetupDay(int day = 0) { if (chartLine.Values == null) { chartLine.Values = new ChartValues <int>(); } if (chartXAxis.Labels == null) { chartXAxis.Labels = new List <string>(); } chartLine.Values.Clear(); chartXAxis.Labels.Clear(); foreach (var item in Days[day].Values) { chartLine.Values.Add(item); } foreach (var item in Days[day].Labels) { chartXAxis.Labels.Add(item); } if (day == 0 && Days[0].Values.Count != Days[1].Values.Count) { for (int i = 0; i < Days[1].Values.Count - Days[0].Values.Count; i++) { chartLine.Values.Add(Days[1].Values[i]); chartXAxis.Labels.Add(Days[1].Labels[i]); } } BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = day == 0 ? icons.GetIcon(Days.LastOrDefault().GetCurrentIcon()) : icons.GetIcon(Days[day].GetDayIcon()); bitmap.EndInit(); imgIcon.Source = bitmap; tbPress.Text = day == 0 ? $"{App.Lang["Pressure"]} {Days[day].GetCurrentPressure()} {App.Lang["mmHG"]}" : $"{App.Lang["Pressure"]} {Days[day].GetDayPressure()} {App.Lang["mmHG"]}"; tbHumi.Text = day == 0 ? $"{App.Lang["Humidity"]} {Days[day].GetCurrentHumidity()} %" : $"{App.Lang["Humidity"]} {Days[day].GetDayHumidity()} %"; tbCondi.Text = day == 0 ? Days.LastOrDefault().GetCurrentCondition() : Days[day].GetDayCondition(); tbThemp.Text = day == 0 ? $"{Days.LastOrDefault().GetCurrentValue()} {sign}" : $"{Days[day].GetDayValue()} {sign}"; tbWind.Text = day == 0 ? $"{App.Lang["Wind"]} {Days[day].GetCurrentWindSpeed()} {windSign}, {ForecastOneDay.GetSideCode(Days[day].GetCurrentWindDeg())}" : $"{App.Lang["Wind"]} {Days[day].GetDayWindSpeed()} {windSign}, {ForecastOneDay.GetSideCode(Days[day].GetDayWindDeg())}"; }
public void SetupDay(int day = 0) { BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = day == 0 ? icons.GetIcon(Days.LastOrDefault().GetCurrentIcon()) : icons.GetIcon(Days[day].GetDayIcon()); bitmap.EndInit(); imgIcon.Source = bitmap; tbPress.Text = day == 0 ? $"{App.Lang["Pressure"]} {Days[day].GetCurrentPressure()} {App.Lang["mmHG"]}" : $"{App.Lang["Pressure"]} {Days[day].GetDayPressure()} {App.Lang["mmHG"]}"; tbHumi.Text = day == 0 ? $"{App.Lang["Humidity"]} {Days[day].GetCurrentHumidity()} %" : $"{App.Lang["Humidity"]} {Days[day].GetDayHumidity()} %"; tbCondi.Text = day == 0 ? Days.LastOrDefault().GetCurrentCondition() : Days[day].GetDayCondition(); tbThemp.Text = day == 0 ? $"{Days.LastOrDefault().GetCurrentValue()} {sign}" : $"{Days[day].GetDayValue()} {sign}"; tbWind.Text = day == 0 ? $"{App.Lang["Wind"]} {Days[day].GetCurrentWindSpeed()} {windSign}, {ForecastOneDay.GetSideCode(Days[day].GetCurrentWindDeg())}" : $"{App.Lang["Wind"]} {Days[day].GetDayWindSpeed()} {windSign}, {ForecastOneDay.GetSideCode(Days[day].GetDayWindDeg())}"; }