private static void GetThisParameterID(SubEditChartNavigationParameter parameter, List<string> parameterIDs) { parameterIDs.Add(parameter.HostParameterID); if (parameter.RelatedParameterIDs != null && parameter.RelatedParameterIDs.Length > 0) { var sel = from i in parameter.RelatedParameterIDs select i.RelatedParameterID; parameterIDs.AddRange(sel); } }
private void InitializeAsync(SubEditChartNavigationParameter parameter, AircraftDataAnalysisModel1.WinRT.Domain.AircraftAnalysisDataLoader dataLoader) { var Xaxis1 = this.tracker1.Axes["xm1XAxis1"] as CategoryXAxis; var Yaxis1 = this.tracker1.Axes["xm1YAxis1"] as NumericYAxis; var Xaxis2 = this.tracker1.Axes["xm1XAxis2"] as CategoryXAxis; var Yaxis2 = this.tracker1.Axes["xm1YAxis2"] as NumericYAxis; Task.Run(new Action(async () => { var viewModel = new AircraftDataAnalysisWinRT.DataModel.FlightAnalysisSubLiteViewModel(); List<string> parameterIDs = new List<string>(); GetThisParameterID(parameter, parameterIDs); //grouped : var groupedIDs = AircraftDataAnalysisModel1.WinRT.DataModel.FlightAnalysisChartGroupFactory.CalculateBindingGroups(parameterIDs); if (groupedIDs == null) return; var groupCount = groupedIDs.Count(); if (groupCount <= 0) return; //只能两个分组,X轴和Y轴 dataLoader.LoadRawDataAsync(parameterIDs); //第一个分组 List<Series> series = new List<Series>(); Dictionary<int, SimpleDataPoint> pointMapper = new Dictionary<int, SimpleDataPoint>(); for (int i = 0; i < dataLoader.CurrentFlight.EndSecond; i++) { pointMapper.Add(i, new SimpleDataPoint() { Second = i }); } var sorted = from one in pointMapper.Values orderby one.Second ascending select one; FlightAnalysisChartSerieViewModel chartviewModel = new FlightAnalysisChartSerieViewModel(sorted); var group1 = groupedIDs.First(); int counter = 0; int counterStart = 0; viewModel.Group1ID = group1.Key; AssignPointMapperValue(dataLoader, pointMapper, ref group1, ref counter); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() => { AssignSerie(Xaxis1, Yaxis1, series, chartviewModel, counter, counterStart, parameterIDs); })); if (groupCount > 1) { counterStart = counter; var group2 = groupedIDs.ElementAt(1); viewModel.Group2ID = group2.Key; AssignPointMapperValue(dataLoader, pointMapper, ref group2, ref counter); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() => { AssignSerie(Xaxis2, Yaxis2, series, chartviewModel, counter, counterStart, parameterIDs); })); } InitFinalizeRunAsync(dataLoader, Xaxis1, Yaxis1, Xaxis2, Yaxis2, viewModel, series, chartviewModel); })); }