public GGServerWindow() { InitializeComponent(); GGServer = new GGServer(GGServer.IPCheck(), PortBlock.Text); IPShower.Text = "Your IP address:" + GGServer.MyIP; mytcp = new MyTCP(GGServer.MyIP, 51212, ref GGServer); }
private void button_Click(object sender, RoutedEventArgs e) { MyTCP mytcp = new MyTCP(); List <User> list = new List <User>(); list = mytcp.ForSearch(); foreach (User user in list) { listBox.Items.Add(user.login); } }
private void buttonLogin_Click(object sender, RoutedEventArgs e) { User user = new User("login", "password", 123); string answer = null; MyTCP mytcp = new MyTCP(); if (mytcp.Login(LoginBox.Text, PasswordBox.Text, ref user, ref answer)) { var wind = new Logged(user); wind.Show(); this.Close(); } else { this.LoginAlert.Text = answer; } }
private void buttonRegister_Click(object sender, RoutedEventArgs e) { if (PasswordBox.Text == ConfirmBox.Text && LoginBox.Text.Length > 3 && PasswordBox.Text != "" & NumberBox.Text.Length > 4) { User usr = new User(LoginBox.Text, PasswordBox.Text, Int32.Parse(NumberBox.Text)); if (AgeBox.Text != "") { usr.Age = Int32.Parse(AgeBox.Text); } if (CityBox.Text != "") { usr.City = CityBox.Text; } if (CountryBox.Text != "") { usr.City = CountryBox.Text; } if (NameBox.Text != "") { usr.Name = NameBox.Text; } if (LastBox.Text != "") { usr.LastName = LastBox.Text; } MyTCP mytcp = new MyTCP(); mytcp.TcpClient(usr); var wind = new RgstredWindow(); wind.Show(); this.Close(); } else if (PasswordBox.Text != ConfirmBox.Text) { AlertBlock.Text = "Password does not match"; } }
public void Listening(MyTCP mytcp) { thread1 = new Thread(mytcp.TcpListener); thread1.Start(); }