private void UpdateInvUI(TagCallbackInfo InventoryInformation) { if (InventoryInformation.crcInvalid == true) { return; } int foundIndex = lock_InvItems.FindIndex(delegate(CSLibrary.Structures.TagCallbackInfo iepc) { return(iepc.epc.ToString() == InventoryInformation.epc.ToString()); }); { if (foundIndex >= 0) { //found a record lock_InvItems[foundIndex].count++; lock_InvItems[foundIndex].rssi = InventoryInformation.rssi; lock_InvItems[foundIndex].index = foundIndex; lock_InvItems[foundIndex].antennaPort = InventoryInformation.antennaPort; //UI update in separate thread UpdateListView(lock_InvItems[foundIndex]); } else { //record no exist //add a record to item list InventoryInformation.index = lock_InvItems.Count; lock_InvItems.Add(InventoryInformation); //UI update in separate thread LVAddItem( InventoryInformation.index.ToString(), InventoryInformation.pc.ToString(), InventoryInformation.epc.ToString(), InventoryInformation.pcpublic.ToString(), InventoryInformation.epcpublic.ToString(), InventoryInformation.rssi.ToString(), InventoryInformation.count.ToString(), InventoryInformation.antennaPort.ToString()); if (SaveSQL) { sqlMethod.AddData(InventoryInformation.epc.ToString()); } } } }
private void UpdateInvUI(TagCallbackInfo InventoryInformation) { if (InventoryInformation.crcInvalid == true) { return; } int foundIndex = lock_InvItems.FindIndex(delegate(CSLibrary.Structures.TagCallbackInfo iepc) { return(iepc.epc.ToString() == InventoryInformation.epc.ToString()); }); { if (foundIndex >= 0) { //found a record lock_InvItems[foundIndex].count++; lock_InvItems[foundIndex].rssi = InventoryInformation.rssi; lock_InvItems[foundIndex].index = foundIndex; lock_InvItems[foundIndex].antennaPort = InventoryInformation.antennaPort; //UI update in separate thread UpdateListView(lock_InvItems[foundIndex]); } else { //record no exist //add a record to item list InventoryInformation.index = lock_InvItems.Count; lock_InvItems.Add(InventoryInformation); string TagDataStr = InventoryInformation.epc.ToString(); string EPCONLY; string TIDONLY = ""; string USERONLY = ""; if (TagDataStr.Length > InventoryInformation.pc.EPCLength * 4) { EPCONLY = TagDataStr.Substring(0, (int)InventoryInformation.pc.EPCLength * 4); if (CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.checkBoxReadTID.Checked) { TIDONLY = TagDataStr.Substring(EPCONLY.ToString().Length, System.Convert.ToInt16(CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.textBoxTIDcount.Text) * 4); } if (CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.checkBoxReadUser.Checked) { USERONLY = TagDataStr.Substring(EPCONLY.ToString().Length + TIDONLY.Length, System.Convert.ToInt16(CS203_CALLBACK_API_DEMO.ControlPanelForm.ControlPanel.textBoxUsercount.Text) * 4); } } else { EPCONLY = TagDataStr; } //UI update in separate thread LVAddItem( InventoryInformation.index.ToString(), InventoryInformation.pc.ToString(), InventoryInformation.xpc_w1.ToString(), InventoryInformation.xpc_w2.ToString(), EPCONLY, TIDONLY, USERONLY, InventoryInformation.rssi.ToString(), InventoryInformation.count.ToString(), InventoryInformation.antennaPort.ToString()); if (SaveSQL) { sqlMethod.AddData(InventoryInformation.epc.ToString()); } } } }