GetCount() public method

public GetCount ( ) : int
return int
示例#1
0
        private void ParseTag(MyTag tag)
        {
            bool foundTag = false;
            int id = -1;
            int count;
            int rowIdx;
            string idstr = "";

            // Look for the tag
            for (rowIdx = 0; rowIdx < tagStatsDataGridView.Rows.Count; rowIdx++)
            {
                idstr = (string)(tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.SERIAL_NUM].Value);
                try
                {
                    id = Convert.ToInt32(idstr);
                }
                catch(Exception e)
                {
                    Trace.WriteLine("exception: " + e.ToString());
                }

                if (tag != null && id == tag.GetSerialNumber())
                {
                    foundTag = true;
                    break;
                }

            }

            // Update the info
            if (foundTag)
            {
                // Update Count
                count = Convert.ToInt32(tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.COUNT].Value);
                count += tag.GetCount();
                tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.COUNT].Value = count;
                tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.SENSOR_TYPE].Value = tag.GetTagTypeName();
                tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.LAST_SEEN].Value = System.DateTime.Now.ToString();
                tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.TX_COUNTER].Value = tag.GetPacketCounter().ToString();
                tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.EPC].Value = tag.GetEpcID().ToString();
                tagStatsDataGridView.Rows[rowIdx].Cells[(int)StatColumnIdx.DATA].Value = tag.GetAccessResultData();
            }
            else // add tag
            {
                string[] newRow = new string[(int)StatColumnIdx.ENUM_MAX_IDX];
                newRow[(int)StatColumnIdx.SERIAL_NUM] = tag.GetSerialNumber().ToString();
                newRow[(int)StatColumnIdx.HW_REV] = tag.GetHardwareRev();
                newRow[(int)StatColumnIdx.SENSOR_TYPE] = tag.GetTagTypeName();
                newRow[(int)StatColumnIdx.COUNT] = tag.GetCount().ToString();
                newRow[(int)StatColumnIdx.LAST_SEEN] = System.DateTime.Now.ToString();
                newRow[(int)StatColumnIdx.TX_COUNTER] = tag.GetPacketCounter().ToString();
                newRow[(int)StatColumnIdx.EPC] = tag.GetEpcID().ToString();
                newRow[(int)StatColumnIdx.DATA] = tag.GetAccessResultData().ToString();
                tagStatsDataGridView.Rows.Add(newRow);
                Trace.WriteLine("Stats Added New Tag: " + tag.GetSerialNumber().ToString());
            }

            // resize columns - this kills performance :(
            // button added instead.
            // tagStatsDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
        }
示例#2
0
 private void HandleTagStats(MyTag t)
 {
     tagCount += t.GetCount();
     lock (newTags)
     {
         newTags.Add(t);
     }
 }
示例#3
0
 public void HandleTagReceived(MyTag t)
 {
     tagCount += t.GetCount();
 }