void client_StateChanged(object sender, ClientStateChangedEventArgs e) { this.Dispatcher.BeginInvoke(new Action(() => { StatusTextBlock.Text = e.NewState.ToString(); }), null); }
void LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.ShuttingDown) { if (_lyncClient != null) { _lyncClient.StateChanged -= LyncClient_StateChanged; _lyncClient.ConversationManager.ConversationAdded -= ConversationManager_ConversationAdded; _lyncClient.DelegatorClientAdded -= _lyncClient_DelegatorClientAdded; _lyncClient.DelegatorClientRemoved -= _lyncClient_DelegatorClientRemoved; } if (_conversation != null) { _conversation.InitialContextReceived -= Conversation_InitialContextReceived; _conversation.ContextDataReceived -= Conversation_ContextDataReceived; _conversation.StateChanged -= Conversation_StateChanged; } if (this.IsActive) { this.Close(); App.Current.Shutdown(); } } }
private void _LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { switch (e.NewState) { case ClientState.SignedOut: if (e.OldState == ClientState.Initializing) { SignUserIn(); } if (e.OldState == ClientState.SigningOut && _lyncClient.InSuppressedMode == true) { _lyncClient.SignInConfiguration.ForgetMe(_signInAddress); } break; case ClientState.Uninitialized: if (e.OldState == ClientState.ShuttingDown) { _lyncClient.StateChanged -= _LyncClient_StateChanged; } break; } }
private void LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (lyncClient != null && lyncClient.Self != null && lyncClient.Self.Contact != null) { DetectProfiles(); } }
/// <summary> /// Handles the event raised when a user signs in to or out of the Lync client. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { try { lync = LyncClient.GetClient(); } catch { Thread.Sleep(sleepInterval); notifyIcon.Visible = false; notifyIcon.Icon = null; Application.Restart(); } //Wait for Lync to sign in while (lync.State != ClientState.SignedIn) { setLED(ERROR); Thread.Sleep(sleepInterval); try { lync = LyncClient.GetClient(); } catch { } } initLyncSubscription(); ShowMessage(null, null); }
void lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { switch (e.NewState) { case ClientState.Initializing: break; case ClientState.Invalid: break; case ClientState.ShuttingDown: break; case ClientState.SignedIn: lyncClient.Self.Contact.ContactInformationChanged += Contact_ContactInformationChanged; SetCurrentContactState(); break; case ClientState.SignedOut: trayIcon.ShowBalloonTip(1000, "", "You signed out in Lync. Switching to manual mode.", ToolTipIcon.Info); break; case ClientState.SigningIn: break; case ClientState.SigningOut: break; case ClientState.Uninitialized: break; default: break; } }
/// <summary> /// Handles UCClient state change events. /// </summary> /// <param name="source">Client. Instance of UCClient as source of events.</param> /// <param name="data">ClientStateChangedEventArgs. State change data.</param> void _LyncClient_ClientStateChanged(Object source, ClientStateChangedEventArgs data) { if (data.NewState == ClientState.SignedIn) { MessageBox.Show("The user is signed in. Proceed to communicate."); } }
void LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.ShuttingDown) { // TODO: Handle Lync Client state changes } }
/// <summary> /// Handles the client state change event /// Updates the client state label on the UI /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void client_StateChanged(object sender, ClientStateChangedEventArgs e) { //Invoke delegate on UI thread that updates client state label this.Invoke(new RefreshClientStateLabelDelegate(RefreshClientStateLabel)); //Invoke a delegate on UI thread to enable or disable room query start button StartQuery_Button.Invoke(new EnableDisableStartQueryButtonDelegate(EnableDisableStartQueryButton)); }
public void client_StateChanged(object sender, ClientStateChangedEventArgs e) { if (_client.State != ClientState.SignedIn) { _room = null; } this.Invoke(new RefreshObjectsDelegate(RefreshSelectedRoomProperties)); }
/// <summary> /// Handles LyncClient state changes for SignedIn and SignedOut /// </summary> /// <param name="sender">object. The LyncClient</param> /// <param name="e">ClientStateChangedEventArgs. The event state.</param> void _LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { // LyncClient client = (LyncClient)sender; switch (e.NewState) { case ClientState.SigningOut: //************************************ //You must unregister for these events in the SigningOut state. Otherwise, you continue //receive events while signing out. If your event handlers for these events call //Lync API methods under this condition, the SignedOutException is raised. //************************************ if (_remoteContact != null) { _remoteContact.ContactInformationChanged -= _remoteContact_ContactInformationChanged; _ClientModel._LyncClient.ConversationManager.ConversationAdded -= ConversationsManager_ConversationAdded; if ((InstantMessageModality)(_Conversation.Modalities[ModalityTypes.InstantMessage]) != null) { ((InstantMessageModality)_Conversation.Modalities[ModalityTypes.InstantMessage]).InstantMessageReceived -= myInstantMessageModality_MessageReceived; ((InstantMessageModality)_Conversation.Modalities[ModalityTypes.InstantMessage]).IsTypingChanged -= myInstantMessageModality_ComposingChanged; _Conversation.Modalities[ModalityTypes.InstantMessage].ModalityStateChanged -= myInstantMessageModality_ModalityStateChanged; } if (_RemoteIMModality != null) { _RemoteIMModality.InstantMessageReceived -= myInstantMessageModality_MessageReceived; _RemoteIMModality.IsTypingChanged -= myInstantMessageModality_ComposingChanged; _RemoteIMModality.ModalityStateChanged -= myInstantMessageModality_ModalityStateChanged; } } break; case ClientState.SignedOut: this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Sign-in State Change: Signed out" }); this.Dispatcher.Invoke(FormActor, new object[] { FormActions.EnableButton, SignIn_Button, null }); break; case ClientState.ShuttingDown: break; case ClientState.SignedIn: _ClientModel._LyncClient.ConversationManager.ConversationAdded += ConversationsManager_ConversationAdded; if (_Conversation == null) { this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Sign-in State Change: Signed in." }); } else { this.Dispatcher.Invoke(FormActor, new object[] { FormActions.UpdateWindowTitle, this, "Sign-in State Change: Signed in. Conversation State: " + _Conversation.State.ToString() }); if (_Conversation.State == ConversationState.Active) { this.Dispatcher.Invoke(FormActor, new object[] { FormActions.SetFormBackColor, this, Brushes.CadetBlue }); } } this.Dispatcher.Invoke(FormActor, new object[] { FormActions.DisableButton, SignIn_Button, null }); break; } }
private void _lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { // if we're signed in if (_lyncClient.State == ClientState.SignedIn) { // attach a presence monitor _lyncClient.Self.Contact.ContactInformationChanged += Contact_ContactInformationChanged; } }
private void Lc_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.SignedIn) { lc.Self.Contact.ContactInformationChanged += Contact_ContactInformationChanged; ContactAvailability availability = (ContactAvailability)lc.Self.Contact.GetContactInformation(ContactInformationType.Availability); ChangeColor(availability); } }
private void ClientStateChangedEvent(object sender, ClientStateChangedEventArgs args) { if (args.OldState == ClientState.SignedIn && args.NewState != ClientState.SignedIn) { DisconnectedAction?.Invoke(); } if (args.OldState != ClientState.SignedIn && args.NewState == ClientState.SignedIn) { ConnnectedAction?.Invoke(); } }
/// <summary> /// Handles lync client state change events such as uninitialized->signed out and /// Signed out -> signed in. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.OldState == ClientState.Uninitialized && e.NewState == ClientState.SignedOut) { SignUserIntoLync(); } if (e.NewState == ClientState.SignedIn) { BindOnlineUsers(); } }
void _client_StateChanged(object sender, ClientStateChangedEventArgs e) { switch (this._client.State) { case ClientState.Initializing: break; case ClientState.SignedOut: this._client.BeginSignIn(UserUri, Username, Password, EndSignIn, null); break; } }
private void StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.SignedIn) { _conversationManager = _lyncClient.ConversationManager; _conversationManager.ConversationAdded += ConversationAdded; } if (e.NewState == ClientState.SignedOut) { _conversationManager.ConversationAdded -= ConversationAdded; } }
/// <summary> /// Called when the state of the Lync client changes. /// Will show the correct controls on the main window based on the client state. /// </summary> void client_StateChanged(object sender, ClientStateChangedEventArgs e) { //posts the execution into the UI thread this.BeginInvoke(new MethodInvoker(delegate() { //shows the current client state toolStripStatusLabel.Text = e.NewState.ToString(); //shows the main content based on the client state ShowMainContent(); })); }
/// <summary> /// Handles the client state change event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void client_StateChanged(object sender, ClientStateChangedEventArgs e) { //If the client has signed in then register for room mananger events if (e.NewState == ClientState.SignedIn) { //Set the NumericUpdown maximum to the count of rooms in the followed room list FollowedRoom_Numeric.Maximum = _client.RoomManager.FollowedRooms.Count; FollowedRoom_Numeric.Minimum = 1; } //Update the form label with the current state of the client this.Invoke(new RefreshClientStateLabelDelegate(RefreshClientStateLabel)); }
/// <summary> /// Lync client state changes event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { //MessageBox.Show("OLD: " + e.OldState + Environment.NewLine + "NEW: " + e.NewState); if (e.NewState == ClientState.SignedIn) { LyncClientSignedIn = true; } else { LyncClientSignedIn = false; } //throw new NotImplementedException(); }
/// <summary> /// Handles the event raised when a user signs in to or out of the Lync client. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { System.Diagnostics.Debug.WriteLine("StateChanged: ({0}) ({1})", e.NewState, e.OldState); switch (e.NewState) { case ClientState.SignedOut: if (e.OldState == ClientState.Initializing) { SignUserIn(); } if (e.OldState == ClientState.SigningOut) { _LyncClient.BeginShutdown((ar) => { _LyncClient.EndShutdown(ar); }, null); } break; case ClientState.Uninitialized: if (e.OldState == ClientState.ShuttingDown) { _LyncClient.StateChanged -= _LyncClient_StateChanged; try { if (CloseAppConditionHit != null) { CloseAppConditionHit(); } } catch (InvalidOperationException oe) { System.Diagnostics.Debug.WriteLine("Invalid operation exception on close: " + oe.Message); } } break; case ClientState.SignedIn: if (UserIsSignedIn != null) { UserIsSignedIn(); } break; } if (ClientStateChanged != null) { ClientStateChanged(e.NewState.ToString()); } }
private void Client_StateChanged(object sender, ClientStateChangedEventArgs e) { switch (e.NewState) { case ClientState.SignedIn: Setup(); break; case ClientState.SigningOut: OnAvailabilityChanged(new AvailabilityEventArgs(new Availability(ContactAvailability.Offline, "Offline"))); Setup(); break; default: break; } }
/// <summary> /// lync状态更改事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { //异步委托 App.Current.Dispatcher.BeginInvoke(new Action(() => { try { //已签入或者签入中 if (e.OldState == ClientState.SigningIn && e.NewState == ClientState.SignedIn) { if (State1CallBack != null) { State1CallBack(); } } //当前lync状态为正要签出的状态 else if (e.OldState == ClientState.SignedIn && e.NewState == ClientState.SigningOut) { #region 恢复未登陆前的状态 if (State2CallBack != null) { State2CallBack(); } #endregion } else if (e.OldState == ClientState.SigningIn && e.NewState == ClientState.SignedOut) { //登陆面板设置为可用 //this.LoginPanelIsEnable = true; if (State3CallBack != null) { State3CallBack(); } } } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } })); }
/// <summary> /// Handles the event raised when a user signs in to or out of the Lync client. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnLyncClientStateChanged(object sender, ClientStateChangedEventArgs e) { switch (e.NewState) { case ClientState.SignedOut: if (e.OldState == ClientState.Initializing) { SignUserIn(); } if (e.OldState == ClientState.SigningOut) { //_lyncClient.BeginShutdown((ar) => //{ // _lyncClient.EndShutdown(ar); //}, null); } break; case ClientState.Uninitialized: if (e.OldState == ClientState.ShuttingDown) { _lyncClient.StateChanged -= OnLyncClientStateChanged; try { } catch (InvalidOperationException oe) { _log.Debug("Invalid operation exception on close: " + oe.Message); } } break; case ClientState.SignedIn: if (UserIsSignedIn != null) { UserIsSignedIn(_lyncClient); } break; } if (ClientStateChanged != null) { ClientStateChanged(e.NewState.ToString()); } }
private static void SkypeClientStateChenged(object sender, ClientStateChangedEventArgs e) { try { switch (e.NewState) { case Microsoft.Lync.Model.ClientState.ShuttingDown: case Microsoft.Lync.Model.ClientState.SignedOut: case Microsoft.Lync.Model.ClientState.SigningOut: case Microsoft.Lync.Model.ClientState.Invalid: _lyncClient = null; Status = ContactAvailability.None; break; } } catch (Exception Ex) { Logger.Log(Ex.Message, Logger.LEVEL.ERROR); } }
/// <summary> /// Handles the event raised when a user signs in to or out of the Lync client. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { //If the client has signed in then get the client's contact list and enable the conversation start button. if (e.NewState == ClientState.SignedIn) { this.Invoke(new LoadAllContactsDelegate(LoadAllContacts)); this.Invoke(new EnableDisableButtonDelegate(EnableDisableButton), new object[] { Start_Button, true }); this.Invoke(new UpdateSharedResourcesListboxDelegate(UpdateSharedResourcesListbox)); } else { this.Invoke(new ClearAllContactsDelegate(ClearAllContacts)); this.Invoke(new EnableDisableButtonDelegate(EnableDisableButton), new object[] { Start_Button, false }); this.Invoke(new ChangeLabelTextDelegate(ChangeLabelText), new object[] { ClientStateString_Label, e.NewState.ToString() }); this.Invoke(new EnableDisableButtonDelegate(EnableDisableButton), new object[] { EndConversation_Button, false }); this.Invoke(new EnableDisableButtonDelegate(EnableDisableButton), new object[] { StartSharingResource_Button, false }); } }
void SignInChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.SignedOut) { try { var client = Microsoft.Lync.Model.LyncClient.GetClient(); client.StateChanged -= SignInChanged; client.Self.Contact.ContactInformationChanged -= Status_Changed; } catch { } _clientCheckTimer.Change(0, SIGNIN_CHECK_TIMEOUT); _updateTimer.Change(System.Threading.Timeout.Infinite, STATUS_CHECK_TIMEOUT); } }
private void _ClientStateChanged(object sender, ClientStateChangedEventArgs e) { switch (e.NewState) { case ClientState.SignedIn: if (this.OnClientSignIn != null) { OnClientSignIn(); } break; case ClientState.SignedOut: if (this.OnClientSignOut != null) { OnClientSignOut(); } break; } }
void CallbackStateChanged(object sender, ClientStateChangedEventArgs e) { switch (e.NewState) { case ClientState.Initializing: break; case ClientState.Invalid: break; case ClientState.ShuttingDown: break; case ClientState.SignedIn: lyncClient.Self.Contact.ContactInformationChanged += CallbackContactInformationChanged; if (sendEvent) { SendState(); } break; case ClientState.SignedOut: if (sendEvent) { callback.WriteState("signed-out", ""); } lyncClient.StateChanged -= CallbackStateChanged; break; case ClientState.SigningIn: break; case ClientState.SigningOut: break; case ClientState.Uninitialized: break; default: break; } }
void OnClientStateChanged(object sender, ClientStateChangedEventArgs e) { try { switch (e.NewState) { case ClientState.SignedIn: SubscribeToLyncEvents(); break; case ClientState.SignedOut: _contact = null; ShowText("Lync signed out"); break; } } catch (Exception) { Cleanup(); } }
//StateChanged event handler private void _LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.SignedIn) { _SendMessage = new SendMessage(); _LyncClient.ConversationManager.ConversationAdded += new EventHandler <ConversationManagerEventArgs>(_SendMessage.ConversationManager_ConversationAdded); } if (e.NewState == ClientState.SignedOut & !SigningOut) //SigningOut is passed in as parameter to the ShutDown and SignIn methods { MessageBox.Show("Lync is beginning to sign in"); System.Collections.Generic.List <string> credentials = new List <string>(); credentials.Add(ConfigurationManager.AppSettings["UserURI1"]); credentials.Add(ConfigurationManager.AppSettings["UserDomainAndUserName"]); string userURI = credentials[0].ToString(); string userDomain = credentials[1].ToString(); ((LyncClient)sender).BeginSignIn(userURI, userDomain, password, SigninCallback, sender); } }
/// <summary> /// Handles the client state change event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void client_StateChanged(object sender, ClientStateChangedEventArgs e) { //If the client has signed out then un-register for events on the room manager if (e.NewState == ClientState.SignedOut) { _client.RoomManager.FollowedRoomAdded -= roomManager_FollowedRoomAdded; _client.RoomManager.FollowedRoomRemoved -= roomManager_FollowedRoomRemoved; _client.RoomManager.RoomManagerStateChanged -= roomManager_RoomManagerStateChanged; } //If the client has signed in then register for room mananger events if (e.NewState == ClientState.SignedIn) { _client.RoomManager.FollowedRoomAdded += roomManager_FollowedRoomAdded; _client.RoomManager.FollowedRoomRemoved += roomManager_FollowedRoomRemoved; _client.RoomManager.RoomManagerStateChanged += roomManager_RoomManagerStateChanged; } //Update the form label with the current state of the client RefreshClientStateLabel(); }
private void _lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { UpdateBuddiesColorBySelfAvailability(); }
void lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState != ClientState.SignedIn) { MessageBox.Show("Lync state changed: " + e.NewState.ToString() + "\r\n Waiting for signing in again"); System.Threading.Thread.Sleep(10000); } }
/// <summary> /// Handler for the StateChanged event of the contact. Used to update the anything with the new client state. /// </summary> private void LyncStateChanged(object sender, ClientStateChangedEventArgs e) { UpdateClient(e.NewState); }
void _lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { }
/// <summary> /// lync状态改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void LyncClientStateChanged(object sender, ClientStateChangedEventArgs e) { threadLyncClientStateChanged = new Thread(new ParameterizedThreadStart(LyncClientStateChangedMethod)); threadLyncClientStateChanged.Priority = ThreadPriority.AboveNormal; // threadLyncClientStateChanged.IsBackground = true; threadLyncClientStateChanged.Start(e); }
private void Client_StateChanged(object sender, ClientStateChangedEventArgs e) { if (!this.client.InSuppressedMode || e.NewState == ClientState.SignedIn) { this.InitializeFavoriteContacts(); } var handler = this.ClientStateChanged; if (handler != null) { handler(this, e); } if (e.NewState == ClientState.SignedOut && this.client.InSuppressedMode == true) { this.SingIn(); } }
private void LyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { Trace.WriteLine(string.Format("LyncFellow: LyncClient_StateChanged e.OldState={0}, e.NewState={1}, e.StatusCode=0x{2:x}", e.OldState, e.NewState, e.StatusCode)); HandleSelfContactEventConnection(e.NewState); UpdateBuddiesColor(); }
private static void Client_StateChanged(object sender, ClientStateChangedEventArgs e) { }
private void Client_StateChanged(object sender, ClientStateChangedEventArgs e) { UpdateUserInterface(e.NewState); }
void _client_StateChanged(object sender, ClientStateChangedEventArgs e) { SubscribetoPresenceIfSignedIn(e.NewState); }
/// <summary> /// Handler for the StateChanged event of the contact. Used to update the user interface with the new client state. /// </summary> private void Client_StateChanged(object sender, ClientStateChangedEventArgs e) { //Use the current dispatcher to update the user interface with the new client state. dispatcher.BeginInvoke(new Action<ClientState>(UpdateUserInterface), e.NewState); }