/// <summary>
        /// Exporter source report completed event handler.
        /// </summary>
        /// <param name="sender">Exporter.</param>
        /// <param name="e">Worker completed event arguments.</param>
        private void _exporter_AsyncExportCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Debug.Assert(null != _exporter);
            Debug.Assert(null != _reportInfos);
            Debug.Assert(!string.IsNullOrEmpty(_sourceFileName));

            _exporter.AsyncExportCompleted -= _exporter_AsyncExportCompleted;

            ICollection <ReportStateDescription> reports = null;

            if (!e.Cancelled && (null == e.Error))
            {
                var reportList = new List <ReportStateDescription>(_reportInfos.Count);
                foreach (string reportName in _reportInfos.Keys)
                {
                    ReportInfo info = _reportInfos[reportName];
                    reportList.Add(_InitReportDescription(_sourceFileName, reportName, info));
                }

                reports = reportList.AsReadOnly();
            }

            _ClearState();

            var args = new CreateReportsCompletedEventArgs(e.Error, e.Cancelled, reports);

            if (null != CreateReportsCompleted)
            {
                CreateReportsCompleted(this, args);
            }
        }
        /// <summary>
        /// Exporter source report completed event handler.
        /// </summary>
        /// <param name="sender">Exporter.</param>
        /// <param name="e">Worker completed event arguments.</param>
        private void _exporter_AsyncExportCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Debug.Assert(null != _exporter);
            Debug.Assert(null != _reportInfos);
            Debug.Assert(!string.IsNullOrEmpty(_sourceFileName));

            _exporter.AsyncExportCompleted -= _exporter_AsyncExportCompleted;

            ICollection<ReportStateDescription> reports = null;
            if (!e.Cancelled && (null == e.Error))
            {
                var reportList = new List<ReportStateDescription>(_reportInfos.Count);
                foreach (string reportName in _reportInfos.Keys)
                {
                    ReportInfo info = _reportInfos[reportName];
                    reportList.Add(_InitReportDescription(_sourceFileName, reportName, info));
                }

                reports = reportList.AsReadOnly();
            }

            _ClearState();

            var args = new CreateReportsCompletedEventArgs(e.Error, e.Cancelled, reports);
            if (null != CreateReportsCompleted)
                CreateReportsCompleted(this, args);
        }
        /// <summary>
        /// Generator create reports completed event handler.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Create reports completed event arguments.</param>
        private void generator_CreateReportsCompleted(object sender,
                                                      CreateReportsCompletedEventArgs e)
        {
            bool finished = true;

            // detouch events
            ReportsGenerator generator = App.Current.ReportGenerator;
            generator.CreateReportsCompleted -= generator_CreateReportsCompleted;

            Debug.Assert(null != _buttonCancel);
            _buttonCancel.Click -= _ButtonCancel_Click;

            // process resultates
            string statusMessage = null;
            if (e.Error != null)
            {   // error occured during operation
                statusMessage = App.Current.FindString("ReportFailedMessage");
                _PopulateReportError(e.Error);
            }
            else if (e.Cancelled)
            {   // operation was cancelled
                statusMessage = App.Current.FindString("ReportCancelledMessage");
                App.Current.Messenger.AddWarning(statusMessage);
            }
            else
            {   // operation successes ending
                ICollection<ReportStateDescription> createdReports = e.Reports;
                Debug.Assert(null != createdReports);
                Debug.Assert(0 < createdReports.Count);

                // if build reports separately
                if (0 < _waitReports.Count)
                {
                    // store created reports
                    if (null == _processor.Reports)
                        _processor.Reports = new List<ReportStateDescription>();
                    foreach (ReportStateDescription report in createdReports)
                        _processor.Reports.Add(report);

                    // remove from wait reports
                    if (1 == createdReports.Count)
                    {
                        ReportStateDescription createdReport = createdReports.First();
                        string createdReportName = createdReport.ReportName;
                        if (_waitReports.Keys.Contains(createdReportName))
                        {
                            _waitReports.Remove(createdReportName);
                        }
                    }

                    createdReports = _processor.Reports;
                }

                if (0 < _waitReports.Count)
                {
                    // do next report creation
                    _buttonCancel.Click += new RoutedEventHandler(_ButtonCancel_Click);

                    _StartFirstWaitReportGeneration();
                    finished = false;
                }
                else
                {
                    // build operation done

                    // sort by template name
                    ICollection<ReportInfo> reportInfos = _GetSelectedTemplates();
                    _processor.Reports = _SortReportsByTemplateName(reportInfos, createdReports);
                    _InitReportsTable();

                    statusMessage = App.Current.FindString("ReportSuccessedMessage");
                    App.Current.Messenger.AddInfo(statusMessage);
                }
            }

            if (finished)
            {   // do GUI to work state
                _statusLabel = null;
                _buttonCancel = null;

                _waitReports.Clear();

                App.Current.MainWindow.StatusBar.SetStatus(this, statusMessage);

                App.Current.UIManager.Unlock();
            }
        }