Fixed cross threading bug

This commit is contained in:
MaxXor 2015-04-03 10:18:57 +02:00
parent 720930f583
commit b3f63d0a79
1 changed files with 3 additions and 1 deletions

View File

@ -183,8 +183,10 @@ private void ClientState(Server server, Client client, bool connected)
} }
else else
{ {
int selectedClients = 0;
this.Invoke((MethodInvoker) delegate this.Invoke((MethodInvoker) delegate
{ {
selectedClients = lstClients.SelectedItems.Count;
foreach (ListViewItem lvi in lstClients.Items) foreach (ListViewItem lvi in lstClients.Items)
{ {
if ((Client) lvi.Tag == client) if ((Client) lvi.Tag == client)
@ -194,7 +196,7 @@ private void ClientState(Server server, Client client, bool connected)
} }
} }
}); });
UpdateWindowTitle(ListenServer.ConnectedClients, lstClients.SelectedItems.Count); UpdateWindowTitle(ListenServer.ConnectedClients, selectedClients);
} }
} }