private void AssignOneValue(KeyValuePair<string, ObservableCollection<FlightDataEntitiesRT.ParameterRawData>> one, T6FAChartSubModel subModel, Dictionary<int, T6FAChartItem> secondMap) { foreach (var vals in one.Value) { T6FAChartItem item = null; if (secondMap.ContainsKey(vals.Second)) { item = secondMap[vals.Second]; } else { item = new T6FAChartItem(); secondMap.Add(vals.Second, item); } item.XValue = vals.Second; if (one.Key == "T6L") { item.T6L = vals.Values[0]; } else if (one.Key == "T6R") { item.T6R = vals.Values[0]; } //subModel.Add(item); } }
internal override FAChartSubModel ToFAChartSubModel() { var subModel = new T6FAChartSubModel() { ParameterID = this.ParameterID }; var pairs = from data in this.viewModel.EntityData where data.Key.StartsWith(this.ParameterID) select data; Dictionary<int, T6FAChartItem> secondMap = new Dictionary<int, T6FAChartItem>(); foreach (var one in pairs) { this.AssignOneValue(one, subModel, secondMap); } var sorted = from one in secondMap orderby one.Key ascending select one.Value; foreach (var m in sorted) { subModel.Add(m); } return subModel; }