void SetTraceData(List <object[]> Rows, string Rtf) { if (this.ScanTraceOverviewGrid.InvokeRequired) { SetTraceData_d CALL_d = new SetTraceData_d(SetTraceData); this.ScanTraceOverviewGrid.Invoke(CALL_d, new object[] { Rows, Rtf }); } else { foreach (object[] Row in Rows) { string Message = Row[9].ToString(); string TagColor = ""; Dictionary <string, Color> TagColors = new Dictionary <string, Color>() { { "cr", Color.IndianRed }, { "co", Color.Orange }, { "h", Color.Orange }, { "hh", Color.Orange }, { "cb", Color.LightBlue }, { "cg", Color.LightGreen }, { "b", Color.LightGray } }; foreach (string TG in new List <string> { "cr", "co", "h", "hh", "cb", "cg", "b" }) //This is used insted of TagColors.Keys to enforce color priority. { string OT = string.Format("<i<{0}>>", TG); string CT = string.Format("<i</{0}>>", TG); if (Message.Contains(OT) && Message.Contains(CT)) { TagColor = TG; break; } } Row[9] = Tools.StripRtfTags(Message); int RowId = this.ScanTraceOverviewGrid.Rows.Add(Row); if (RowId == 0) { if (ScanTraceOverviewGrid.Rows[0].Cells[2].Value != null) { try { BaselineLogId = Int32.Parse(ScanTraceOverviewGrid.Rows[0].Cells[2].Value.ToString()); } catch { } } } if (TagColor.Length > 0) { this.ScanTraceOverviewGrid.Rows[RowId].DefaultCellStyle.BackColor = TagColors[TagColor]; } } this.ScanTraceMsgRTB.Rtf = Rtf; this.MainLoadProgressBar.Visible = false; this.BaseSplit.Visible = true; } }
void SetTraceData(List<object[]> Rows, string Rtf) { if (this.ScanTraceOverviewGrid.InvokeRequired) { SetTraceData_d CALL_d = new SetTraceData_d(SetTraceData); this.ScanTraceOverviewGrid.Invoke(CALL_d, new object[] { Rows, Rtf }); } else { foreach (object[] Row in Rows) { string Message = Row[9].ToString(); string TagColor = ""; Dictionary<string, Color> TagColors = new Dictionary<string, Color>(){ {"cr", Color.IndianRed}, {"co", Color.Orange}, {"h", Color.Orange}, {"hh", Color.Orange}, {"cb", Color.LightBlue}, {"cg", Color.LightGreen}, {"b", Color.LightGray} }; foreach (string TG in new List<string> { "cr", "co", "h", "hh", "cb", "cg", "b" })//This is used insted of TagColors.Keys to enforce color priority. { string OT = string.Format("<i<{0}>>", TG); string CT = string.Format("<i</{0}>>", TG); if (Message.Contains(OT) && Message.Contains(CT)) { TagColor = TG; break; } } Row[9] = Tools.StripRtfTags(Message); int RowId = this.ScanTraceOverviewGrid.Rows.Add(Row); if (RowId == 0) { if (ScanTraceOverviewGrid.Rows[0].Cells[2].Value != null) { try { BaselineLogId = Int32.Parse(ScanTraceOverviewGrid.Rows[0].Cells[2].Value.ToString()); } catch { } } } if (TagColor.Length > 0) { this.ScanTraceOverviewGrid.Rows[RowId].DefaultCellStyle.BackColor = TagColors[TagColor]; } } this.ScanTraceMsgRTB.Rtf = Rtf; this.MainLoadProgressBar.Visible = false; this.BaseSplit.Visible = true; } }