Esempio n. 1
0
        /**************************************************************************/

        public void RefreshKeywordAnalysisDataProgress(MacroscopeDocumentCollection DocCollection)
        {
            MacroscopeDoublePercentageProgressForm ProgressForm = new MacroscopeDoublePercentageProgressForm(this.MainForm);

            decimal MajorPercentage = 0;

            if (MacroscopePreferencesManager.GetShowProgressDialogues())
            {
                ProgressForm.UpdatePercentages(
                    Title: "Preparing Display",
                    Message: "Processing keyword terms collection for display:",
                    MajorPercentage: MajorPercentage,
                    ProgressLabelMajor: "",
                    MinorPercentage: 0,
                    ProgressLabelMinor: ""
                    );
            }

            try
            {
                ProgressForm.TopMost = true;
            }
            catch (Exception ex)
            {
                DebugMsg(string.Format("ProgressForm.Show(): {0}", ex.Message));
            }

            for (int i = 0; i <= 3; i++)
            {
                List <ListViewItem> ListViewItems = new List <ListViewItem> (DocCollection.CountDocuments());

                Application.DoEvents();

                if (!ProgressForm.Cancelled())
                {
                    Dictionary <string, int> DicTerms = DocCollection.GetDeepKeywordAnalysisAsDictonary(Words: i + 1);


                    if (MacroscopePreferencesManager.GetShowProgressDialogues())
                    {
                        MajorPercentage = (( decimal )100 / ( decimal )4) * ( decimal )(i + 1);

                        ProgressForm.UpdatePercentages(
                            Title: null,
                            Message: null,
                            MajorPercentage: MajorPercentage,
                            ProgressLabelMajor: string.Format("{0} Word Keywords", i + 1),
                            MinorPercentage: 0,
                            ProgressLabelMinor: ""
                            );
                    }

                    this.TargetListViews[i].BeginUpdate();

                    this.RenderKeywordAnalysisListView(
                        ListViewItems: ListViewItems,
                        TargetListView: this.TargetListViews[i],
                        DicTerms: DicTerms,
                        ProgressForm: ProgressForm
                        );

                    this.TargetListViews[i].Items.AddRange(ListViewItems.ToArray());

                    this.TargetListViews[i].EndUpdate();
                }
            }

            if (MacroscopePreferencesManager.GetShowProgressDialogues())
            {
                ProgressForm.DoClose();
            }

            if (ProgressForm != null)
            {
                ProgressForm.Dispose();
            }
        }