private void Button_Click(object sender, RoutedEventArgs e) { bool check = ErrorControls.NotEmptyTextBox(tbName); if (check) { ReplyNewUser newUser = null; try { // connect to the server ... handler = new CallbackHandler(); site = new InstanceContext(handler); proxy = new ConnectionClient(site); // logging newUser = proxy.Join(tbName.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (newUser != null) { ClientWindow client = new ClientWindow(newUser); client.Owner = this; client.Show(); this.Hide(); } } }