private async void btnTest_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; var clientPlatformSettings = new ClientPlatformSettings("LyncZMachine", SipTransportType.Tls); var collabPlatform = new CollaborationPlatform(clientPlatformSettings); await collabPlatform.StartupAsync(); var settings = new UserEndpointSettings(txtSip.Text, txtServer.Text) { Credential = new NetworkCredential(txtUsername.Text, txtPassword.Text, txtDomain.Text), AutomaticPresencePublicationEnabled = true }; var endpoint = new UserEndpoint(collabPlatform, settings); await endpoint.EstablishAsync(); btnSave.Enabled = true; MessageBox.Show("Connected successfully to " + txtServer.Text + " as " + txtSip.Text); try { await endpoint.TerminateAsync(); await collabPlatform.ShutdownAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message, "An Error Occurred", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "An Error Occurred", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); btnSave.Enabled = false; } finally { Cursor = Cursors.Default; } }