// кнопка входу в систему private void LoginButton_Click(object sender, RoutedEventArgs e) { if (PasswordBox.Password != "" && LoginBox.Text != "") { if (PasswordBox.Password.Length > 4) { client.Connect(); string answer = client.LogIn(LoginBox.Text, PasswordBox.Password); if (answer == "succesfully") { MainWindow mw = new MainWindow(client); Close(); mw.ShowDialog(); } else if (answer == "No user with this password") { MessageBox.Show(answer); PasswordBox.Foreground = Brushes.Red; } else if (answer == "No user with this login") { MessageBox.Show(answer); LoginBox.Foreground = Brushes.Red; } else { MessageBox.Show("Something wrong!!!"); client.Disconnect(); Close(); } } else { MessageBox.Show("Password is short, minimum 5 characters!!!"); PasswordBox.Password = ""; } } else { MessageBox.Show("Fill all the gaps!!!"); } }