public void BuildChartData(string StationName, string ShortName, string CurrentWRWName, WRWData wrwData) { Dictionary<int, KeyValuePair<DateTime, float?>> dictionary = wrwData.Data24hList; this.airDataContext.WRWData24hList.Clear(); for (int i = 0; i < dictionary.Count; i++) { KeyValuePair<DateTime, float?> pair = dictionary[0]; DateTime time = pair.Key.AddHours((double) (-1 * ((dictionary.Count - 1) - i))); KeyValuePair<DateTime, float?> pair2 = dictionary[i]; WRWData24h item = new WRWData24h(StationName, CurrentWRWName, pair2.Value, time, new float?(Convert.ToSingle(wrwData.AVG24h))); this.airDataContext.WRWData24hList.Add(item); } }
private void dataService_GetRTC24hCompleted(object sender, GetRTC24hCompletedEventArgs e) { if (((e.Error == null) && (e.Result != null)) && (e.Result.Count > 0)) { this.airDataContext.WRWData24hList.Clear(); foreach (TB_RTC tb_rtc in e.Result) { WRWData24h item = new WRWData24h(tb_rtc.Station, tb_rtc.Pollutant, tb_rtc.Value, tb_rtc.Date_Time, tb_rtc.AVG24h); this.airDataContext.WRWData24hList.Add(item); } } }