private void button1_Click(object sender, EventArgs ea) { ECHO_COUNT++; var client = new JokeContractClient(cbo.Text); client.Headers.Add(new AuthenticationHeader(new IDPasswordCredentials(tbID.Text, tbPwd.Text))); try { var echoed = chkUnsecureEcho.Checked ? client.UnsecureEcho("Hello!") : client.Echo("Hello!"); Text = echoed + " " + ECHO_COUNT.ToString() + " times"; } catch (Exception e) { Text = e.ToMessageWithType(); } client.Dispose(); }