Improved client removal from listview

This commit is contained in:
MaxXor 2015-05-28 11:01:29 +02:00
parent 955aea9e17
commit 8a6709ba9f
1 changed files with 3 additions and 6 deletions

View File

@ -218,14 +218,11 @@ private void ClientState(Server server, Client client, bool connected)
int selectedClients = 0;
this.Invoke((MethodInvoker) delegate
{
foreach (ListViewItem lvi in lstClients.Items)
{
if ((Client) lvi.Tag == client)
foreach (ListViewItem lvi in lstClients.Items.Cast<ListViewItem>().Where(lvi => (Client)lvi.Tag == client))
{
lvi.Remove();
server.ConnectedClients--;
}
}
selectedClients = lstClients.SelectedItems.Count;
});
UpdateWindowTitle(ListenServer.ConnectedClients, selectedClients);