ListView疑问??
部分代码:
//删除当前DTU的信息记录
public void removeListView(Client client)
{
if (clients.Contains(client.Rtua))
{
clients.Remove(client.Rtua);
listView1.Items.RemoveByKey(client.Rtua);
//listView1.Items.Remove(listView1.Items[client.Rtua]);
}
this.tbClientsNum.Text = System.Convert.ToString(clients.Count);
//client.StopFlag = true;
//client.CurrentSocket.Close();
listView1.Refresh();
ListViewItem lvi = new ListViewItem();
lvi.Tag = client.Rtua;
lvi.Text = client.Rtua;
lvi.SubItems.Add(getIPAddress());
lvi.SubItems.Add(tbSocketPort.Text);
lvi.SubItems.Add(DateTime.Now.ToString());
lvi.SubItems.Add(client.IpAddress);
lvi.SubItems.Add(client.Port);
lvi.SubItems.Add(client.ProtocolType);
lvi.SubItems.Add( "No ");
this.listView1.Items.Add(lvi);
client.StopFlag = true;
client.CurrentSocket.Close();
}
//添加DTU并更新界面状态
public void addListView(Client client)
{
if (clients.Contains(client.Rtua))