// do backlight private void DoBacklight(gridBackLightMessage item) { // colors Color set = Color.Yellow; Color reset = item.Row.Row.Cells[ColumnDataIdxOffset - 1].Style.BackColor; int[] timestamps = item.Ts; item.BacklightFlag = item.areNewData(); for (int i = 0; i < timestamps.Length; i++) { var cell = item.Row.Row.Cells[ColumnDataIdxOffset + i]; bool needToBl = timestamps[i] > 0; cell.Style.BackColor = needToBl ? set : reset; cell.Style.SelectionForeColor = needToBl ? set : reset; } }
// push a new message or update an existing one public void push(gridRow msg, List <byte[]> dataList) { long key = msg.GetHashCodeUnique(); bool exists = dict.ContainsKey(key); if (exists) { dict[key].update(dataList); } else { // create a new one gridBackLightMessage item = new gridBackLightMessage(msg, dataList[dataList.Count - 1], BacklightFor, Interval); dict.Add(key, item); } // backlight it immideately DoBacklight(dict[key]); }