private void InitializeClient() { UserSignIn signin = new UserSignIn(this._LyncClient); signin.StartUpLync(false); //*********************************************************************************** // This application works with UISuppressionMode = true or false // // UISuppressionMode hides the Lync user interface. // // Registry key for enabling UISuppressionMode: // // 32bit OS: // [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\15.0\Lync] // "UISuppressionMode"=dword:00000001 // // 64bit OS: // [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Communicator] // "UISuppressionMode"=dword:00000001 // // When running with UISuppressionMode = 1 and this application is the only one // using the client, it's necessary to Initialize the client. The following check // verifies if the client has already been initialized. If it hasn't, the code will // call BeginInitialize() proving a callback method, on which this application's // main UI will be presented (either Sign-In or contact input, if already signed in). //*********************************************************************************** //if this client is in UISuppressionMode... if (_LyncClient.InSuppressedMode && _LyncClient.State == ClientState.Uninitialized) { //...need to initialize it try { _LyncClient.BeginInitialize(this.ClientInitialized, null); } catch (LyncClientException lyncClientException) { Console.WriteLine(lyncClientException); } catch (SystemException systemException) { if (Utilities.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; } } } else //not in UI Suppression, so the client was already initialized { //registers for conversation related events //these events will occur when new conversations are created (incoming/outgoing) and removed _LyncClient.ConversationManager.ConversationAdded += ConversationManager_ConversationAdded; _LyncClient.ConversationManager.ConversationRemoved += ConversationManager_ConversationRemoved; //show sign-in or contact selection //ShowMainContent(); } }