//----------------------------------------------------------------------- // get an counter value for a message public int getMessageCounter(canMessage2 msg) { gridList list = Parser.GetList(); var item = list.getGridMessage(msg); if (item == null) { return(-1); } return(item.Count); }
//----------------------------------------------------------------------- // get an interval value for a message public int getMessageInterval(canMessage2 msg) { gridList list = Parser.GetList(); var item = list.getGridMessage(msg); if (item == null) { return(-1); } return(item.Period); }
// push a message list public void push(List <canMessage2> ls) { if (ls.Count == 0) { return; } bool doSortInTheEnd = false; // parse gridList parsed = Parser.Parse(ref ls); // handle foreach (gridMessage msg in parsed.List) { // the message can be empty if we had it before but not now if (msg.DataListBuff.Count == 0) { continue; } // get all the data we need string sId = msg.Id.GetIdAsString(); string sDlc = msg.Id.GetDlcAsString(); string[] data = msg.Data.Split(' '); int count = msg.Count; int period = msg.Period; // get a row for the message DataGridViewRow row = getMsgRow(msg.Id); bool isRowEnabled = isRowChecked(row); // exist? // nope - we have a new message // yeap - just update it if (null == row) { // add a new one row = addNewRow(sId, sDlc, data, period, count); doSortInTheEnd = true; isRowEnabled = true; // it's enabled now // put the current message and the new row inside the row contaiter (for performance) RowList.add(new gridRow(msg.Id, row)); } else { // update it if (isRowEnabled) { updateRow(row, data, period, count); } } // tools if (isRowEnabled) { // get data for the row gridRow gr = RowList.find(msg.Id); if (use_tools) { // tool 1 - backlight BacklightTool.push(gr, msg.DataListBuff); // tool 2 - tips GridTipTool.tipTextUpdate(row, m_colData.Index, msg.DataListBuff); } } } // sort if (doSortInTheEnd) { doSort(); } }