void _LyncClient_CredentialRequested(object sender, CredentialRequestedEventArgs e) { if (e.Type == CredentialRequestedType.SignIn) { using (CredentialForm _CredentialForm = new CredentialForm()) { _CredentialForm.ShowDialog(); if (_CredentialForm.DialogResult == true) { e.Submit( _CredentialForm.userDomain, _CredentialForm.userPassword, false); } } } }
/// <summary> /// Signs a user into Lync. /// </summary> private void SignUserIn() { //******************************************************** //If the UI of the Lync client is not suppressed then you do //not collect user credentials for signing in. Instead, the //Windows network credentials are used. //******************************************************** if (_ClientModel._LyncClient.InSuppressedMode == false && _ClientModel._LyncClient.State != ClientState.SignedIn) { //******************************************************** //Call a helper method from the ClientModel helper class. UI //thread is blocked until user is signed in. //******************************************************** _ClientModel.SignIn(null, null, null); return; } //******************************************************** //If Lync is in UI supression mode and not signed in, collect user credentials and sign in. //******************************************************** if (_ClientModel._LyncClient.InSuppressedMode == true && _ClientModel._LyncClient.State != ClientState.SignedIn) { _CredentialForm = new CredentialForm(); _CredentialForm.ShowDialog(); if (_CredentialForm.DialogResult == true) { //******************************************************** //Client model handles the state checking and async code necessary before attempting to //sign a user in. //******************************************************** _ClientModel.SignIn( _CredentialForm.userSIP, _CredentialForm.userDomain, _CredentialForm.userPassword); } } this.Cursor = Cursors.Arrow; }