private void LoadSimpleDataPoints(FlightAnalysisChartSerieViewModel vm, string parameterID, Domain.AircraftAnalysisDataLoader dataLoader, int serieNum) { IEnumerable<ParameterRawData> rawdatas = dataLoader.GetRawData(parameterID); if (rawdatas == null) return; Dictionary<int, MyControl.SimpleDataPoint> pointMap = new Dictionary<int, MyControl.SimpleDataPoint>(); foreach (var v in vm) { if (pointMap.ContainsKey(v.Second)) continue; pointMap.Add(v.Second, v); } #region debug test //var serie1 = vm; //serie1.Add(new AircraftDataAnalysisModel1.WinRT.MyControl.SimpleDataPoint() //{ // Label = 1, // Value = 3 //}); //serie1.Add(new AircraftDataAnalysisModel1.WinRT.MyControl.SimpleDataPoint() //{ // Label = 2, // Value = 4 //}); //serie1.Add(new AircraftDataAnalysisModel1.WinRT.MyControl.SimpleDataPoint() //{ // Label = 3, // Value = 2 //}); //serie1.Add(new AircraftDataAnalysisModel1.WinRT.MyControl.SimpleDataPoint() //{ // Label = 4, // Value = 1 //}); //serie1.Add(new AircraftDataAnalysisModel1.WinRT.MyControl.SimpleDataPoint() //{ // Label = 5, // Value = 5 //}); //serie1.Add(new AircraftDataAnalysisModel1.WinRT.MyControl.SimpleDataPoint() //{ // Label = 6, // Value = 3 //}); //return;//debug #endregion foreach (var rd in rawdatas) {//暂时先写死第一秒钟的值 if (pointMap.ContainsKey(rd.Second)) { if (serieNum == 0) pointMap[rd.Second].Value1 = rd.Values[0]; else if (serieNum == 1) pointMap[rd.Second].Value2 = rd.Values[0]; else if (serieNum == 2) pointMap[rd.Second].Value3 = rd.Values[0]; } else { var point = new MyControl.SimpleDataPoint() { Second = rd.Second }; if (serieNum == 0) point.Value1 = rd.Values[0]; else if (serieNum == 1) point.Value2 = rd.Values[0]; else if (serieNum == 2) point.Value3 = rd.Values[0]; pointMap.Add(rd.Second, point); } } var result = from pt in pointMap orderby pt.Key ascending select pt.Value; foreach (var re in result) { if (!vm.Contains(re)) vm.Add(re); } }