/**************************************************************************/ private void RenderListView(Dictionary <ulong, bool> History, MacroscopeDocumentCollection DocCollection) { if (History.Count == 0) { return; } List <ListViewItem> ListViewItems = new List <ListViewItem>(1); MacroscopeAllowedHosts AllowedHosts = this.MainForm.GetJobMaster().GetAllowedHosts(); MacroscopeSinglePercentageProgressForm ProgressForm = new MacroscopeSinglePercentageProgressForm(this.MainForm); decimal Count = 0; decimal TotalDocs = (decimal)History.Count; decimal MajorPercentage = ((decimal)100 / TotalDocs) * Count; if (MacroscopePreferencesManager.GetShowProgressDialogues()) { ProgressForm.UpdatePercentages( Title: "Preparing Display", Message: "Processing document collection for display:", MajorPercentage: MajorPercentage, ProgressLabelMajor: string.Format("Document {0} / {1}", Count, TotalDocs) ); } foreach (ulong DocKey in History.Keys) { ListViewItem lvItem = null; MacroscopeDocument msDoc = DocCollection.GetDocumentByDocKey(DocKey: DocKey); string PairKey = DocKey.ToString(); if (msDoc != null) { string Url = msDoc.GetUrl(); string Visited = "No"; string InDocCollection = "No"; if (History.ContainsKey(DocKey) && History[DocKey]) { Visited = "Yes"; } if (DocCollection.ContainsDocument(Url: Url)) { InDocCollection = "Yes"; } if (this.DisplayListView.Items.ContainsKey(PairKey)) { try { lvItem = this.DisplayListView.Items[PairKey]; lvItem.SubItems[ColUrl].Text = Url; lvItem.SubItems[ColVisited].Text = Visited; lvItem.SubItems[ColInDocCollection].Text = InDocCollection; } catch (Exception ex) { DebugMsg(string.Format("RenderListView 1: {0}", ex.Message)); } } else { try { lvItem = new ListViewItem(PairKey); lvItem.UseItemStyleForSubItems = false; lvItem.Name = PairKey; lvItem.SubItems[0].Text = Url; lvItem.SubItems.Add(Visited); lvItem.SubItems.Add(InDocCollection); ListViewItems.Add(lvItem); } catch (Exception ex) { DebugMsg(string.Format("RenderListView 2: {0}", ex.Message)); } } if (lvItem != null) { lvItem.ForeColor = Color.Blue; if (AllowedHosts.IsInternalUrl(Url)) { lvItem.SubItems[ColUrl].ForeColor = Color.Green; if (History.ContainsKey(DocKey) && History[DocKey]) { lvItem.SubItems[ColVisited].ForeColor = Color.Green; } else { lvItem.SubItems[ColVisited].ForeColor = Color.Red; } lvItem.SubItems[ColInDocCollection].ForeColor = Color.Blue; } else { lvItem.SubItems[ColUrl].ForeColor = Color.Gray; lvItem.SubItems[ColVisited].ForeColor = Color.Gray; lvItem.SubItems[ColInDocCollection].ForeColor = Color.Gray; } } } if (MacroscopePreferencesManager.GetShowProgressDialogues()) { Count++; TotalDocs = (decimal)History.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(); } }