/**************************************************************************/ public void RefreshData( MacroscopeDocumentCollection DocCollection, MacroscopeConstants.DocumentType DocumentType ) { try { if (DocCollection.CountDocuments() <= 0) { return; } if (this.MainForm.InvokeRequired) { this.MainForm.Invoke( new MethodInvoker( delegate { Cursor.Current = Cursors.WaitCursor; this.DisplayListView.BeginUpdate(); this.RenderListView( DocCollection: DocCollection, DocumentType: DocumentType ); this.RenderUrlCount(); this.DisplayListView.EndUpdate(); Cursor.Current = Cursors.Default; } ) ); } else { Cursor.Current = Cursors.WaitCursor; this.DisplayListView.BeginUpdate(); this.RenderListView( DocCollection: DocCollection, DocumentType: DocumentType ); this.RenderUrlCount(); this.DisplayListView.EndUpdate(); Cursor.Current = Cursors.Default; } } catch (Exception ex) { this.DebugMsg(string.Format("RefreshData: {0}", ex.Message)); } }
/** Render Filtered DocCollection *******************************************/ public void RenderListView( MacroscopeDocumentCollection DocCollection, MacroscopeConstants.DocumentType DocumentType ) { if (DocCollection.CountDocuments() == 0) { return; } List <ListViewItem> ListViewItems = new List <ListViewItem>(DocCollection.CountDocuments()); MacroscopeSinglePercentageProgressForm ProgressForm = new MacroscopeSinglePercentageProgressForm(this.MainForm); decimal Count = 0; decimal TotalDocs = (decimal)DocCollection.CountDocuments(); decimal MajorPercentage = ((decimal)100 / TotalDocs) * Count; if (MacroscopePreferencesManager.GetShowProgressDialogues()) { ProgressForm.ControlBox = false; ProgressForm.UpdatePercentages( Title: "Preparing Display", Message: "Processing document collection for display:", MajorPercentage: MajorPercentage, ProgressLabelMajor: string.Format("Document {0} / {1}", Count, TotalDocs) ); } foreach (MacroscopeDocument msDoc in DocCollection.IterateDocuments()) { Application.DoEvents(); if (msDoc != null) { switch (DocumentType) { case MacroscopeConstants.DocumentType.INTERNALURL: if (msDoc.GetIsInternal()) { this.RenderListView( ListViewItems: ListViewItems, DocCollection: DocCollection, msDoc: msDoc, Url: msDoc.GetUrl() ); } break; case MacroscopeConstants.DocumentType.EXTERNALURL: if (msDoc.GetIsExternal()) { this.RenderListView( ListViewItems: ListViewItems, DocCollection: DocCollection, msDoc: msDoc, Url: msDoc.GetUrl() ); } break; default: if ( (msDoc.GetDocumentType() == DocumentType) || (DocumentType == MacroscopeConstants.DocumentType.ALL)) { this.RenderListView( ListViewItems: ListViewItems, DocCollection: DocCollection, msDoc: msDoc, Url: msDoc.GetUrl() ); } break; } } if (MacroscopePreferencesManager.GetShowProgressDialogues()) { Count++; MajorPercentage = ((decimal)100 / TotalDocs) * Count; ProgressForm.UpdatePercentages( Title: null, Message: null, MajorPercentage: MajorPercentage, ProgressLabelMajor: string.Format("Document {0} / {1}", Count, TotalDocs) ); } } this.DisplayListView.Items.AddRange(ListViewItems.ToArray()); if (MacroscopePreferencesManager.GetShowProgressDialogues()) { ProgressForm.DoClose(); } if (ProgressForm != null) { ProgressForm.Dispose(); } }