Exemplo n.º 1
0
        private void AsyncProgressCheckThread()
        {
            TAsyncExecProgressState ProgressState;
            Int16    ProgressPercentage;
            String   ProgressInformation;
            String   OldLoggingText;
            DateTime startTime;

            OldLoggingText = "";
            startTime      = DateTime.Now;

            while (FKeepUpProgressCheck)
            {
                FReportingGenerator.AsyncExecProgress.ProgressCombinedInfo(out ProgressState, out ProgressPercentage, out ProgressInformation);

                switch (ProgressState)
                {
                case TAsyncExecProgressState.Aeps_Finished:
                    this.Duration = DateTime.Now - startTime;

                    if (FReportingGenerator.GetSuccess() == true)
                    {
                        this.Parameters.LoadFromDataTable(FReportingGenerator.GetParameter());
                        this.Results.LoadFromDataTable(FReportingGenerator.GetResult());
                        this.Results.SetMaxDisplayColumns(this.Parameters.Get("MaxDisplayColumns").ToInt());
                    }
                    else
                    {
                        TLogging.Log(FReportingGenerator.GetErrorMessage());
                    }

                    FKeepUpProgressCheck = false;
                    break;

                default:

                    if ((ProgressInformation != null) && (!OldLoggingText.Equals(ProgressInformation)))
                    {
                        TLogging.Log(ProgressInformation, TLoggingType.ToStatusBar);
                        OldLoggingText = ProgressInformation;
                    }

                    break;
                }

                if (FKeepUpProgressCheck)
                {
                    // Sleep for some time. Then check again for latest progress information
                    Thread.Sleep(500);
                }
            }
        }
Exemplo n.º 2
0
        private void AsyncProgressCheckThread()
        {
            String   OldLoggingText;
            DateTime startTime;

            OldLoggingText = "";
            startTime      = DateTime.Now;

            while (FKeepUpProgressCheck)
            {
                TProgressState state = FReportingGenerator.Progress;

                if (state.JobFinished)
                {
                    this.Duration = DateTime.Now - startTime;

                    if (FReportingGenerator.GetSuccess() == true)
                    {
                        this.Parameters.LoadFromDataTable(FReportingGenerator.GetParameter());
                        this.Results.LoadFromDataTable(FReportingGenerator.GetResult());
                        this.Results.SetMaxDisplayColumns(this.Parameters.Get("MaxDisplayColumns").ToInt());
                    }
                    else
                    {
                        TLogging.Log(FReportingGenerator.GetErrorMessage());
                    }

                    FKeepUpProgressCheck = false;
                }
                else
                {
                    if ((state.StatusMessage != null) && (!OldLoggingText.Equals(state.StatusMessage)))
                    {
                        TLogging.Log(state.StatusMessage, TLoggingType.ToStatusBar);
                        OldLoggingText = state.StatusMessage;
                    }
                }

                if (FKeepUpProgressCheck)
                {
                    // Sleep for some time. Then check again for latest progress information
                    Thread.Sleep(500);
                }
            }
        }
Exemplo n.º 3
0
        private void AsyncProgressCheckThread()
        {
            String    OldLoggingText;
            DateTime  startTime;
            String    ErrorMessage = null;
            Exception ServersideException;

            OldLoggingText = "";
            startTime      = DateTime.Now;

            while (FKeepUpProgressCheck)
            {
                TProgressState state = FReportingGenerator.Progress;

                if (state.JobFinished)
                {
                    this.Duration = DateTime.Now - startTime;

                    if (FReportingGenerator.GetSuccess() == true)
                    {
                        this.Parameters.LoadFromDataTable(FReportingGenerator.GetParameter());
                        this.Results.LoadFromDataTable(FReportingGenerator.GetResult());
                        this.Results.SetMaxDisplayColumns(this.Parameters.Get("MaxDisplayColumns").ToInt());
                    }
                    else
                    {
                        ErrorMessage = FReportingGenerator.GetErrorMessage(out ServersideException);

                        if (ErrorMessage != null)
                        {
                            if (ErrorMessage != String.Empty)
                            {
                                if (!ErrorMessage.StartsWith(
                                        SharedConstants.NO_PARALLEL_EXECUTION_OF_XML_REPORTS_PREFIX,
                                        StringComparison.InvariantCulture))
                                {
                                    TLogging.Log(ErrorMessage, FStatusBarProcedure);
                                }
                                else
                                {
                                    FStatusBarProcedure(ErrorMessage.Substring(
                                                            SharedConstants.NO_PARALLEL_EXECUTION_OF_XML_REPORTS_PREFIX.Length));
                                }
                            }
                            else
                            {
                                // We get here e.g. when Report Generation was cancelled: this clears anything that the
                                // Status Bar has previously shown.
                                FStatusBarProcedure(String.Empty);
                            }

                            // Let any Exception that happened server-side escalate to the 'Unhandled Exception Handler'
                            // to give it visibility
                            if (ServersideException != null)
                            {
                                throw ServersideException;
                            }
                        }
                    }

                    FKeepUpProgressCheck = false;
                }
                else
                {
                    if ((state.StatusMessage != null) && (!OldLoggingText.Equals(state.StatusMessage)))
                    {
                        TLogging.Log(state.StatusMessage, TLoggingType.ToStatusBar, FStatusBarProcedure);
                        OldLoggingText = state.StatusMessage;
                    }
                }

                if (FKeepUpProgressCheck)
                {
                    // Sleep for some time. Then check again for latest progress information
                    Thread.Sleep(500);
                }
            }
        }