private void DoImportCore(AddFileViewModel model)
        {
            try
            {
                var parameters = ApplicationContext.Instance.GetFlightParameters(
                    ApplicationContext.Instance.CurrentAircraftModel);

                var extractor = FlightDataReading.AircraftModel1.FlightRawDataExtractorFactory
                    .CreateFlightRawDataExtractor(model.File, parameters);

                IDataReading reading = new DataReading(extractor, model.Flight,
                    parameters);

                reading.Header = model.Header;
                reading.ReadData();
            }
            catch (Exception ex)
            {
                //SERVER log?
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
        private void DoImportCore()
        {
            try
            {
                var parameters = ApplicationContext.Instance.GetFlightParameters(
                    ApplicationContext.Instance.CurrentAircraftModel);

                var extractor = FlightDataReading.AircraftModel1.FlightRawDataExtractorFactory
                    .CreateFlightRawDataExtractor(this.AddFileViewModel.File, parameters);

                IDataReading reading = new DataReading(extractor, this.AddFileViewModel.Flight,
                    parameters);

                reading.Progress = new AsyncActionProgressHandler<int>(
                    async delegate(IAsyncActionWithProgress<int> prog, int progressInt)
                    {
                        await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High,
                            new Windows.UI.Core.DispatchedHandler(delegate()
                            {
                                this.AddFileViewModel.Progress(prog, progressInt);
                            }));
                    });

                reading.Completed = new AsyncActionWithProgressCompletedHandler<int>(
                    async delegate(IAsyncActionWithProgress<int> prog, AsyncStatus status)
                    {
                        await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High,
                            new Windows.UI.Core.DispatchedHandler(delegate()
                            {
                                this.AddFileViewModel.Completed(prog, status);
                            }));
                    });

                reading.Header = this.AddFileViewModel.Header;
                reading.ReadData();

                this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                    new Windows.UI.Core.DispatchedHandler(delegate()
                {
                    this.m_runningTask = null;

                    //completed!
                    ApplicationContext.Instance.CurrentFlight = reading.Flight;
                    this.Frame.GoBack();
                    this.Frame.Navigate(typeof(PStudio.WinApp.Aircraft.FDAPlatform.Domain.FlightAnalysis));//不带参数,当前架次已经改变
                }));
            }
            catch (Exception ex)
            {
                //SERVER log?
                System.Diagnostics.Debug.WriteLine(ex.Message);
                this.AddFileViewModel.Completed(this.AddFileViewModel, AsyncStatus.Error);
            }
        }
        private void readToDb_Click(object sender, RoutedEventArgs e)
        {
            if (this.ViewModel == null)
                return;

            this.ViewModel.Progress += new AsyncActionProgressHandler<int>(this.OnProgressChanged);
            this.ViewModel.Completed = new AsyncActionWithProgressCompletedHandler<int>(this.OnCompleted);

            this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                new Windows.UI.Core.DispatchedHandler(
                    delegate()
                    {
                        var parameters = ServerHelper.GetFlightParameters(ServerHelper.GetCurrentAircraftModel());

                        var extractor = FlightDataReading.AircraftModel1.FlightRawDataExtractorFactory
                            .CreateFlightRawDataExtractor(this.ViewModel.File, parameters);

                        IDataReading reading = new DataReading(extractor, this.CurrentFlight,
                            parameters);
                        reading.Header = this.ViewModel.Header;
                        reading.ReadData();

                        this.tbMessage.Text = string.Format("{1} ReadData Complete: {0}", DateTime.Now, this.CurrentFlight.FlightID);
                    }));
        }