Ejemplo n.º 1
0
        /// <summary>
        /// Callback invoked when LyncClient.BeginSignOut is completed
        /// </summary>
        /// <param name="result">The status of the asynchronous operation</param>
        private void SignOutCallback(IAsyncResult result)
        {
            try
            {
                lyncClient.EndSignOut(result);
            }
            catch (LyncClientException e)
            {
                Console.WriteLine(e);
            }
            catch (SystemException systemException)
            {
                if (IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

        }
 private void _LyncClient_CredentialRequested(object sender, CredentialRequestedEventArgs e)
 {
     //If the request for credentials comes from Lync server then sign out, get new creentials
     //and sign in.
     if (e.Type == CredentialRequestedType.LyncAutodiscover)
     {
         try
         {
             _retries = _retries + 1;
             if ((_retries < 10))
             {
                 _lyncClient.BeginSignOut(ar =>
                 {
                     _lyncClient.EndSignOut(ar);
                     //Ask user for credentials and attempt to sign in again
                     SignUserIn();
                 }, null);
             }
             else
             {
                 _lyncClient.BeginSignOut(ar =>
                 {
                     _lyncClient.EndSignOut(ar);
                     _signInProcedureEvent.Set();
                 }, null);
             }
         }
         catch (Exception ex)
         {
             Trace.WriteLine($"Exception on attempt to sign in, abandoning sign in: {ex.Message}, Lync Client sign in delay");
         }
     }
     else
     {
         e.Submit(_username, _password, false);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Raised when user's credentials are rejected by Lync or a service that
 /// Lync depends on requests credentials
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnLyncClientCredentialRequested(object sender, CredentialRequestedEventArgs e)
 {
     //If the request for credentials comes from Lync server then sign out, get new creentials
     //and sign in.
     if (e.Type == CredentialRequestedType.LyncAutodiscover)
     {
         try
         {
             _lyncClient.BeginSignOut((ar) =>
             {
                 _lyncClient.EndSignOut(ar);
                 //Ask user for credentials and attempt to sign in again
                 SignUserIn();
             }, null);
         }
         catch (Exception ex)
         {
             _log.ErrorException("OnLyncClientCredentialRequested", ex);
         }
     }
     else
     {
     }
 }
 private static void EndSignout(IAsyncResult result)
 {
     try
     {
         _client.EndSignOut(result);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex);
     }
     finally
     {
         _client.BeginShutdown(EndShutdown, _client);
     }
 }
        //SignOut callback method
        // Called asynchronously by client instance after Signout()
        private void SignOutCallback(IAsyncResult ar)
        {
            MessageBox.Show("SignOutCallback method");
            _Client.EndSignOut(ar);

            _Client.ConversationManager.ConversationAdded -= new EventHandler <ConversationManagerEventArgs>(_SignIn._SendMessage.ConversationManager_ConversationAdded);

            if (_Client.InSuppressedMode == true)
            {
                if (_Client.State == ClientState.SignedOut)
                {
                    _Client.BeginShutdown(ShutDownCallback, null);
                    MessageBox.Show("BeginShutdown method");
                }
            }
        }
Ejemplo n.º 6
0
 private void signOutCallback(IAsyncResult ar)
 {
     Log("Sign Out Callback, calling EndSignOut()");
     lyncClient.EndSignOut(ar);
 }