public void UpdateUserList(string sUsr, String sIP, string sPortVideo, string sPortAudio, bool bAdd, Socket sck) { try { if (!lstUsers.InvokeRequired) { // remove if exist int i; for (i = 0; i < _listUsr.Count; i++) { User tmp = (User)_listUsr[i]; if (tmp.GetUser() == sUsr) { _listUsr.Remove(tmp); lstUsers.Items.Remove(sUsr); } } if (bAdd){ User usr = new User(sUsr, sIP, sck); usr.SetIepAudio(Convert.ToInt32(sPortAudio)); usr.SetIepVideo(Convert.ToInt32(sPortVideo)); _listUsr.Add(usr); lstUsers.Items.Add(sUsr); } } else { UpdateUserListCallback d = new UpdateUserListCallback(UpdateUserList); Invoke(d, new object[] { sUsr, sIP, sPortVideo, sPortAudio, bAdd, sck }); } } catch (Exception) { } }