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);
            }));
        }
        private void InitFinalizeRunAsync(AircraftDataAnalysisModel1.WinRT.Domain.AircraftAnalysisDataLoader dataLoader, CategoryXAxis Xaxis1, NumericYAxis Yaxis1, CategoryXAxis Xaxis2, NumericYAxis Yaxis2, FlightAnalysisSubLiteViewModel viewModel, List<Series> series, FlightAnalysisChartSerieViewModel chartviewModel)
        {
            this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                new Windows.UI.Core.DispatchedHandler(() =>
                {
                    viewModel.ChartViewModel = chartviewModel;

                    this.DataContext = viewModel;
                    viewModel.SelectedParameterIDChanged += viewModel_SelectedParameterIDChanged;
                    //    }));

                    //this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                    //    new Windows.UI.Core.DispatchedHandler(() =>
                    //{
                    this.DataLoader = dataLoader;

                    Xaxis1.DataContext = chartviewModel;
                    Yaxis1.DataContext = chartviewModel;
                    Xaxis2.DataContext = chartviewModel;
                    Yaxis2.DataContext = chartviewModel;
                    foreach (var se in series)
                    {
                        this.tracker1.Series.Add(se);
                    }

                    this.progbar1.IsIndeterminate = false;
                    this.progbar1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                }));
        }
        private void InitializeExtremumInfo(ExtremumReportSubEditChartNavigationParameter 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 (true || groupCount > 1)
                {
                    counterStart = 0;//counter;
                    var group2 = groupedIDs.First(); //groupedIDs.ElementAt(1);
                    viewModel.Group2ID = group2.Key;
                    AssignPointMapperValue(dataLoader, pointMapper, ref group2, ref counter);
                    counter = 1;

                    await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                        new Windows.UI.Core.DispatchedHandler(() =>
                        {
                            AssignSerie(Xaxis2, Yaxis2, series, chartviewModel, counter, counterStart, parameterIDs);
                        }));
                }

                viewModel.ChartViewModel = chartviewModel;

                this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                    new Windows.UI.Core.DispatchedHandler(() =>
                    {
                        this.TitleLegend.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        //必须去掉Legend,因为两条线是可能出两个Legend的
                        //加参数的Stack也要去掉
                        this.stackAddParam.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        //Yaxis2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        Yaxis2.LabelSettings.Foreground = new SolidColorBrush(Windows.UI.Colors.White);
                        //this.DataContext = viewModel;
                        //viewModel.SelectedParameterIDChanged += viewModel_SelectedParameterIDChanged;
                    }));

                this.InitFinalizeRunAsync(dataLoader, Xaxis1, Yaxis1, Xaxis2, Yaxis2,
                    viewModel, series, chartviewModel);
            }));
        }