예제 #1
0
        private void UpdateProgressBar(int progress, BackgroundWorkerState state)
        {
            switch (state)
            {
            case BackgroundWorkerState.ActionAnalyzerInitialize:
            {
                InitProgressBar(progress);
                break;
            }

            case BackgroundWorkerState.ExternalCatalogInitialize:
            {
                InitProgressBar(progress);
                break;
            }

            case BackgroundWorkerState.ActionAnalyzerReportProgress:
            {
                lblStatus.Text    = string.Format("Шаг 1 из 3, анализ действий пользователей. \nПроанализировано действий {0} из {1}", progress.ToString(), progressBar.Maximum);
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.ExternalCatalogReportProgress:
            {
                lblStatus.Text    = string.Format("Шаг 2 из 3, считывание данных из внешнего каталога. \nСчитано документов {0} из {1}", progress.ToString(), progressBar.Maximum);
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.ClusterAnalyzerReportProgress:
            {
                lblStatus.Text    = string.Format("Шаг 3 из 3, кластеризация запросов. \nОбработано запросов {0} из {1}", progress.ToString(), progressBar.Maximum);
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.CatalogCheckerReportProgress:
            {
                lblStatus.Text    = progress.ToString();
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.ActionAnalyzerDone:
            {
                progressBar.Value = progressBar.Maximum;
                lblStatus.Text    = "Шаг 1 завершен. \nЗапросов для дальнейшего анализа: " + _actionAnalyzerWorker.GetResult().Count;
                string path = _settings.ExternalCatalogType == Constants.USE_XML ? _settings.ExternalCatalogPath : null;
                _externalCatalogReaderWorker.RunWorker(path);
                break;
            }

            case BackgroundWorkerState.ExternalCatalogDone:
            {
                progressBar.Value = progressBar.Maximum;
                lblStatus.Text    = "Шаг 2 завершен. \nСчитано документов: " + _externalCatalogReaderWorker.GetResult().Count;
                _clusterAnalyzerWorker.RunWorker(_actionAnalyzerWorker.GetResult(), _externalCatalogReaderWorker.GetResult());
                break;
            }

            case BackgroundWorkerState.ClusterAnalyzerDone:
            {
                progressBar.Value = progressBar.Maximum;
                lblStatus.Text    = "Шаг 3 завершен. \nПолучено рекомендаций: " + _clusterAnalyzerWorker.GetResult().Count;
                _parent.ShowResult(_clusterAnalyzerWorker.GetResult());
                Close();
                break;
            }

            case BackgroundWorkerState.CatalogCheckerDone:
            {
                progressBar.Value = progressBar.Maximum;
                lblStatus.Text    = "CatalogCheckerDone! Total = " + _catalogCheckerWorker.GetResult().Count;
                break;
            }
            }
        }
예제 #2
0
        private void UpdateProgressBar(int progress, BackgroundWorkerState state)
        {
            switch (state)
            {
            case BackgroundWorkerState.ActionAnalyzerInitialize:
            {
                InitProgressBar(progress);
                break;
            }

            case BackgroundWorkerState.ExternalCatalogInitialize:
            {
                InitProgressBar(progress);
                break;
            }

            case BackgroundWorkerState.ActionAnalyzerReportProgress:
            {
                label1.Text       = progress.ToString();
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.ExternalCatalogReportProgress:
            {
                label1.Text       = progress.ToString();
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.ClusterAnalyzerReportProgress:
            {
                label1.Text       = progress.ToString();
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.CatalogCheckerReportProgress:
            {
                label1.Text       = progress.ToString();
                progressBar.Style = ProgressBarStyle.Continuous;
                progressBar.Value = progress;
                break;
            }

            case BackgroundWorkerState.ActionAnalyzerDone:
            {
                progressBar.Value = progressBar.Maximum;
                label1.Text       = "ActionAnalyzerDone! Total = " + _actionAnalyzerWorker.GetResult().Count;
                _externalCatalogReaderWorker.RunWorker(null);
                break;
            }

            case BackgroundWorkerState.ExternalCatalogDone:
            {
                progressBar.Value = progressBar.Maximum;
                label1.Text       = "ExternalCatalogDone! Total = " + _externalCatalogReaderWorker.GetResult().Count;
                _clusterAnalyzerWorker.RunWorker(_actionAnalyzerWorker.GetResult(), _externalCatalogReaderWorker.GetResult());
                break;
            }

            case BackgroundWorkerState.ClusterAnalyzerDone:
            {
                progressBar.Value = progressBar.Maximum;
                label1.Text       = "ClusterAnalyzerDone! Total = " + _clusterAnalyzerWorker.GetResult().Count;
                _catalogCheckerWorker.RunWorker(_clusterAnalyzerWorker.GetResult());
                break;
            }

            case BackgroundWorkerState.CatalogCheckerDone:
            {
                progressBar.Value = progressBar.Maximum;
                label1.Text       = "CatalogCheckerDone! Total = " + _catalogCheckerWorker.GetResult().Count;
                break;
            }
            }
        }