public void Connect() { if (isOnline == false) { try { helper.Ready(); if (helper.tcpClient != null) { DataHelpers.ShowHandler += ShowMsg; helper.DataHandler += CC.DataHandle.Handle; Task.Run(() => helper.ReceiveData()); isOnline = true; } else { ShowMsg(null, "无法连接到服务器"); } } catch (Exception e) { ShowMsg(null, e.Message); } } }
public ServerUser(TcpClient tcpClient) { Helper = new TCPHelper(); Helper.tcpClient = tcpClient; Helper.DataHandler += DataHelpers.Handle4Server; Helper.Ready(); Task.Run(() => Helper.ReceiveData()); }
public UserOnServer(TcpClient tcpClient) { helper = new TCPHelper(); helper.tcpClient = tcpClient; helper.DataHandler += CC.DataHandle.Handle; helper.Ready(); Task.Run(() => helper.ReceiveData()); }
public SignupWindow() { InitializeComponent(); DataHelpers.ShowHandler += this.ShowMsg; Task.Run(() => tcpHelper.ReceiveData()); }