public void SignUserIn()
 {
     try
     {
         _lyncClient.BeginSignIn(_signInAddress, _username, _password, ar =>
         {
             try
             {
                 _lyncClient.EndSignIn(ar);
                 _signInProcedureEvent.Set();
             }
             catch (LyncClientException clientExcpetion)
             {
                 string message = clientExcpetion.Message;
                 if (message.StartsWith("Generic COM Exception", StringComparison.InvariantCultureIgnoreCase))
                 {
                     _badSignInAddressIdentified = true;
                     _signInProcedureEvent.Set();
                 }
             }
             catch (Exception exc)
             {
                 Trace.WriteLine($"exception on endsignin: {exc.Message})");
             }
         }, null);
     }
     catch (ArgumentException ae)
     {
         Trace.WriteLine($"exception on beginsignin: {ae.Message})");
     }
 }
Ejemplo n.º 2
0
 public void Initialize()
 {
     try
     {
         _lyncClient = LyncClient.GetClient();
         _lyncClient.StateChanged += StateChanged;
         if (_lyncClient.State == ClientState.SignedOut)
         {
             _lyncClient.BeginSignIn(
                 null,
                 null,
                 null,
                 (ar) =>
             {
                 _lyncClient.EndSignIn(ar);
             }
                 ,
                 null);
         }
         else if (_lyncClient.State == ClientState.SignedIn)
         {
             _conversationManager = _lyncClient.ConversationManager;
             _conversationManager.ConversationAdded += ConversationAdded;
         }
     }
     catch (NotStartedByUserException)
     {
         throw new Exception("Lync is not running");
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Signs a user in to Lync as one of two possible users. User that is
        /// signed in depends on whether side-by-side client is chosen.
        /// </summary>
        internal void SignUserIn()
        {
            //Set the sign in credentials of the user to the
            //appropriate credentials for the endpoint mode
            string userUri      = _userUri;
            string userPassword = _userPassword;

            _log.Info("SignUserIn  Start");

            _userUri = userUri;
            _lyncClient.BeginSignIn(
                userUri,
                userUri,
                userPassword,
                (ar) =>
            {
                try
                {
                    _lyncClient.EndSignIn(ar);
                    _log.Info("SignUserIn End");
                }
                catch (Exception exc)
                {
                    _log.ErrorException("SignUserIn", exc);
                }
            },
                null);
        }
Ejemplo n.º 4
0
 private void SignUserIn()
 {
     try
     {
         _LyncClient.BeginSignIn(
             "*****@*****.**",
             "*****@*****.**",
             "Win2013@",
             (ar) =>
         {
             try
             {
                 _LyncClient.EndSignIn(ar);
             }
             catch (Exception exc)
             {
                 MessageBox.Show("exception on endsignin: " + exc.Message);
             }
         },
             null);
     }
     catch (ArgumentException ae)
     {
         MessageBox.Show("exception on beginsignin: " + ae.Message);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Callback invoked when LyncClient.BeginSignIn is completed
        /// </summary>
        /// <param name="result">The status of the asynchronous operation</param>
        private void SignInCallback(IAsyncResult result)
        {
            try
            {
                lyncClient.EndSignIn(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;
                }
            }

        }
Ejemplo n.º 6
0
        public void SignIn(string user = null, string password = null)
        {
            if (client.State != ClientState.SignedOut)
            {
                throw new InvalidStateException("Skype / Lync client must be signed out in order to sign in a new user");
            }

            client.BeginSignIn(
                user,
                user,
                password,
                ar =>
            {
                client.EndSignIn(ar);
            },
                null);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Sign in the Lync client
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SignInButton_Click(object sender, RoutedEventArgs e)
 {
     if (_client.State != ClientState.SignedIn)
     {
         _client.BeginSignIn("*****@*****.**", "domain\\johns", "password", (ar) =>
         {
             _client.EndSignIn(ar);
         }, null);
     }
 }
Ejemplo n.º 8
0
 private void HandleEndSignIn(IAsyncResult ar)
 {
     try
     {
         client.EndSignIn(ar);
     }
     catch (Exception e)
     {
         Console.Out.WriteLine(e);
     }
 }
 /// <summary>
 /// Starts the asynchronous sign in process
 /// </summary>
 private void SignUserIntoLync()
 {
     if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["UserID"].ToString()) &&
         !string.IsNullOrEmpty(ConfigurationManager.AppSettings["Password"].ToString()))
     {
         lyncClient.BeginSignIn(
             ConfigurationManager.AppSettings["UserID"].ToString(),
             ConfigurationManager.AppSettings["UserID"].ToString(),
             ConfigurationManager.AppSettings["Password"].ToString(),
             (ar) =>
         {
             lyncClient.EndSignIn(ar);
         }
             , null);
     }
 }
Ejemplo n.º 10
0
 private void SignInCallback(IAsyncResult ar)
 {
     Log("Sign In Callback, calling EndSignIn()");
     lyncClient.EndSignIn(ar);
 }