/// <summary> /// 刷新用户列表 /// </summary> /// <param name="list">用户列表</param> private void DoUserChanged(UserCollection list) { if (_UserChangedHandle != null) { System.Windows.Forms.Control c = (_UserChangedHandle.Target as Control); if (c != null) { c.Invoke(_UserChangedHandle, list); } else { _UserChangedHandle(list); } } }
//刷新用户列表 private static void OnUserChanged(UserCollection users) { System.Console.WriteLine("======= Online User Count:{0} ======", users.Count); foreach (User u in users) { System.Console.WriteLine( "User:{0},IP:{1}:{2},IsHoled:{3}", u.UserName, u.NetPoint.Address, u.NetPoint.Port, u.IsConnected ); } System.Console.WriteLine("====================================", users.Count); }
public S2C_UserListMessage(UserCollection users) { this.userList = users; }
/// <summary> /// 构造器 /// </summary> public Server() { _userList = new UserCollection(); _remotePoint = new IPEndPoint(IPAddress.Any, 0); _serverThread = new Thread(new ThreadStart(Run)); }
//刷新用户列表 private void OnUserChanged(UserCollection users) { listBox2.DisplayMember = "FullName"; listBox2.DataSource = null; listBox2.DataSource = users; }