private void ItemAdd(Taglist_Manager.List_Tag _Tag) { //Add new Item to listview_tag with kyhTag class. //Create listview item instance. ListViewItem _Item = new ListViewItem(listView_Tag.Items.Count.ToString()); _Item.SubItems.Add(_Tag.ID); //EPC ID write. _Item.SubItems.Add(_Tag.Ant); //Antenna write. _Item.SubItems.Add(_Tag.RSSI.ToString()); //RSSI value write. _Item.SubItems.Add(_Tag.GATE); _Item.SubItems.Add("0"); //Time span is 0. listView_Tag.Items.Add(_Item); //Add item to listview. }
private bool ItemUpdate(ListViewItem _Item, Taglist_Manager.List_Tag _Tag) { //Update listview control's item with kyhTag class. if (_Item.SubItems[1].Text == _Tag.ID) { //If EPC IDs are same... _Item.SubItems[0].Text = (_Item.Index + 1).ToString(); //Data Number. _Item.SubItems[2].Text = _Tag.Ant; //Antenna Number update. _Item.SubItems[3].Text = _Tag.RSSI.ToString(); //RSSI update. TimeSpan _Span = DateTime.Now - _Tag.Time; //Calculate time span. _Item.SubItems[4].Text = _Tag.GATE; _Item.SubItems[5].Text = _Span.Seconds.ToString(); //Time span update. return(true); } else { //If EPC IDs are not same... return(false); //Do nothing. } }