private void LoginButton_Click(object sender, RoutedEventArgs e) { LoginInfoLable.Content = string.Empty; if (!GameTCP.TcpClient.Connected) { try { GameTCP.StartUp(IPAddress.Loopback); } catch (Exception exc) { LoginInfoLable.Content = "无法连接服务器,请重试"; return; } } LoginIn loginIn = new LoginIn() { UserName = UsernameTextB.Text, Password = PasswordTextB.Password }; GameTCP.SendAsync(loginIn); }
public Task Login(LoginIn loginIn) { return(GameTCPClient.SendAsync(loginIn)); }