private void ButtonLogin_Click(object sender, RoutedEventArgs e) { client.NewHandler("sym"); bool auth = client.Login(this.TextBoxName.Text, this.TextBoxPassword.Text); //client knows about username if (auth) { ChatWindow chat = new ChatWindow(); chat.AddService(client); chat.SetUpUser(); chat.Title = this.TextBoxName.Text; chat.Show(); } else { MessageBox.Show("Sorry, incorrect username or password. Try again."); } }