public static ClientConnection GetConnection(string login, string password) { try { connection = ClientConnection.GetInstance(login, password); } catch (Exception e) { return(null); } return(connection); }
private void RegClickBtn(object sender, RoutedEventArgs e) { if (LoginBox.Text.Length > 8 && PassBox.Text.Length > 8 && NameBox.Text.Length > 2) { connection = ClientConnection.GetInstance(); connection.Connection("#Server: _Registration" + " " + LoginBox.Text + " " + PassBox.Text + " " + NameBox.Text); while (true) { if (ClientConnection.registered == "registered") { this.Content = new ChatControl(); break; } } } else { MessageBox.Show("Login box lengh should be more than 8 symbols."); } }
public ChatControl() { connection = ClientConnection.GetInstance(); InitializeComponent(); DataContext = new ChatControlViewModel(); }