void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { string returnValue = string.Empty; StringBuilder sb = new StringBuilder(); Boolean raiseUpdate = false; if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { //get actual contactModel availability (Will be int value within OCOM availaiblity ranges) ContactAvailability availEnum = (ContactAvailability)((Contact)sender).GetContactInformation(ContactInformationType.Availability); string activityString = (string)((Contact)sender).GetContactInformation(ContactInformationType.Activity); sb.Append(availEnum.ToString() + " " + activityString); raiseUpdate = true; } if (raiseUpdate) { returnValue = "Updated availability for " + ((Contact)sender).GetContactInformation(ContactInformationType.DisplayName).ToString() + System.Environment.NewLine + sb.ToString(); } Dictionary <PublishableContactInformationType, object> publishState = new Dictionary <PublishableContactInformationType, object>(); publishState.Add(PublishableContactInformationType.Availability, ContactAvailability.Free); writeMessage("simulate mouse click" + DateTime.Now.ToString()); DoMouseClick(); //_lyncClient.Self.BeginPublishContactInformation(publishState, publishState_callback, null); }
/// <summary> /// Handler for the ContactInformationChanged event of the contact. Used to update the contact's information in the user interface. /// </summary> private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Only update the contact information in the user interface if the client is signed in. //Ignore other states including transitions (e.g. signing in or out). if (lyncClient.State == ClientState.SignedIn) { //Get from Lync only the contact information that changed. if (e.ChangedContactInformation.Contains(ContactInformationType.DisplayName)) { //Use the current dispatcher to update the contact's name in the user interface. dispatcher.BeginInvoke(new Action(SetName)); } if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { //Use the current dispatcher to update the contact's availability in the user interface. dispatcher.BeginInvoke(new Action(SetAvailability)); } if (e.ChangedContactInformation.Contains(ContactInformationType.PersonalNote)) { //Use the current dispatcher to update the contact's personal note in the user interface. dispatcher.BeginInvoke(new Action(SetPersonalNote)); } if (e.ChangedContactInformation.Contains(ContactInformationType.Photo)) { //Use the current dispatcher to update the contact's photo in the user interface. dispatcher.BeginInvoke(new Action(SetContactPhoto)); } } }
void contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { OnPresenceChanged(GetPresence()); } }
void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { SetCurrentContactState(); } }
private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { Debug.WriteLine("Contact information changed"); if (e.ChangedContactInformation.Contains(ContactInformationType.Activity) || e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { var activity = _client.Self.Contact.GetContactInformation(ContactInformationType.ActivityId); ContactAvailability availability = (ContactAvailability)_client.Self.Contact.GetContactInformation(ContactInformationType.Availability); if (availability == ContactAvailability.Busy && activity.ToString().ToLower() == "on-the-phone") { if (!_pauseEnabled) { TriggerPauseButton(activity.ToString()); _pauseEnabled = true; UpdateStatus(); } } else { if (_pauseEnabled) { TriggerPauseButton(activity.ToString()); _pauseEnabled = false; UpdateStatus(); } } } }
private void ContactChangeStatusUpdate(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.ActivityId)) { SetCurrentLyncStatus(); } }
/// <summary> /// 参会人状态更改捕获事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { try { App.Current.Dispatcher.BeginInvoke(new Action(() => { if (Constant.lyncClient != null && Constant.lyncClient.State == ClientState.SignedIn) { //获取联系人 Contact contact = sender as Contact; if (contact != null) { System.Collections.Generic.List<object> list = (System.Collections.Generic.List<object>)contact.GetContactInformation(ContactInformationType.EmailAddresses); if (list.Count > 0 && currentParticipantsEntityList != null) { //double state = Convert.ToDouble(contact.GetContactInformation(ContactInformationType.Availability)); List<ParticipantsEntity> participantsEntityTempList = currentParticipantsEntityList.Where(item => item.LoginUri.ToLower().Equals(Convert.ToString(list[0]).ToLower())).ToList<ParticipantsEntity>(); if (participantsEntityTempList.Count > 0) { ParticipantsEntity Participant = participantsEntityTempList[0]; string uriImg = Constant.TreeServiceAddressFront + Constant.FtpServercePersonImgName + Participant.LoginName + ".png"; BitmapImage btimap = new BitmapImage(new Uri(uriImg)); string strState = Convert.ToString(contact.GetContactInformation(ContactInformationType.Activity)); //bool imgIsExit = UriManage.RemoteFileExists(uriImg); if (strState.Equals("脱机")) { Participant.LoginState = "未登录"; Participant.StateForeBrush = App.Current.Resources["NormalColorBrush"] as SolidColorBrush; Participant.HeadPortrait = ImageManage.ToGray(btimap); } else { Participant.LoginState = "在线"; Participant.StateForeBrush = App.Current.Resources["GreenColorBrush"] as SolidColorBrush; Participant.HeadPortrait = btimap; } //获取当前人的公司名称 Participant.Company = Convert.ToString(contact.GetContactInformation(ContactInformationType.Company)); ////获取当前人的职位 Participant.Position = Convert.ToString(contact.GetContactInformation(ContactInformationType.Title)); } if (BeginRefleshDataGridCallBack != null) { BeginRefleshDataGridCallBack(currentParticipantsEntityList); } } } } })); } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
void contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { var contact = sender as Contact; foreach (var info in e.ChangedContactInformation) { switch (info) { case ContactInformationType.Availability: var availability = (ContactAvailability)contact.GetContactInformation(info); switch (availability) { case ContactAvailability.Free: // set user online break; default: // set user offline break; } break; } } }
void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Any(x => x == ContactInformationType.Availability)) { OnAvailabilityChanged((Contact)sender); } }
private static void SelfStatusHasChanged(object sender, ContactInformationChangedEventArgs e) { // Console.WriteLine("FOOBAR"); if (GetLyncAvailability() != currentPresence) { DisplayContactPresence(); } }
private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Set LED matching Lync/SfB state Console.WriteLine("Lync/SfB state changed!"); ContactAvailability myAvailability = (ContactAvailability)lyncClient.Self.Contact.GetContactInformation(ContactInformationType.Availability); controlBusylight(string.Format("kSetLed,{0};", myAvailability.ToString())); }
private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (lyncClient.State == ClientState.SignedIn) { if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { SetAvailability(); } } }
private void Skype_ContactInfoChangedSync(object s, ContactInformationChangedEventArgs e) { //Check if the availability has changed or if it's something else if (e.ChangedContactInformation.Contains(ContactInformationType.Activity)) { SkypeAvailabilitySync(); } }
/// <summary> /// Handler for the ContactInformationChanged event of the contact /// </summary> private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Only update the contact information in the user interface if the client is signed in. //Ignore other states including transitions (e.g. signing in or out). if (LyncClientSignedIn && _lyncClient.State == ClientState.SignedIn) { //If activity or availablity info is changed if (e.ChangedContactInformation.Contains(ContactInformationType.Activity) || e.ChangedContactInformation.Contains(ContactInformationType.Availability) || e.ChangedContactInformation.Contains(ContactInformationType.PersonalNote)) { Activity = _lyncClient.Self.Contact.GetContactInformation(ContactInformationType.ActivityId); Availability = (ContactAvailability)_lyncClient.Self.Contact.GetContactInformation(ContactInformationType.Availability); PersonalNote = _lyncClient.Self.Contact.GetContactInformation(ContactInformationType.PersonalNote); //Raise LccContactInfoEvent update event for availability and activity states if (LccContactInfoEvent != null) { LccContactInfoEvent(Availability.ToString(), Activity.ToString()); } ////If busy and the busy state is "on-the-phone" //if (Availability == ContactAvailability.Busy && Activity.ToString().ToLower() == "on-the-phone") //{ //} ////If busy //if (Availability == ContactAvailability.Busy) //{ //} } ////Get from Lync only the contact information that changed. //if (e.ChangedContactInformation.Contains(ContactInformationType.DisplayName)) //{ // //Use the current dispatcher to update the contact's name in the user interface. // //dispatcher.BeginInvoke(new Action(SetName)); //} //if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) //{ // //Use the current dispatcher to update the contact's availability in the user interface. // //dispatcher.BeginInvoke(new Action(SetAvailability)); //} //if (e.ChangedContactInformation.Contains(ContactInformationType.PersonalNote)) //{ // //Use the current dispatcher to update the contact's personal note in the user interface. // //dispatcher.BeginInvoke(new Action(SetPersonalNote)); //} //if (e.ChangedContactInformation.Contains(ContactInformationType.Photo)) //{ // //Use the current dispatcher to update the contact's photo in the user interface. // //dispatcher.BeginInvoke(new Action(SetContactPhoto)); //} } }
private void _ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { _GetContactInfo(); if (OnContactInformationChanged != null) { OnContactInformationChanged(); } }
/// <summary> /// This method is called when the ContactInformationChangedEvent is triggered, and will trigger this event if the status has changed. /// </summary> private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { var contact = sender as Contact; if (e.ChangedContactInformation.Contains(ContactInformationType.Activity)) { Trigger(); } }
private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { foreach (ContactInformationType changedInformationType in e.ChangedContactInformation) { if (changedInformationType == ContactInformationType.Availability) { UpdateBuddiesColorBySelfAvailability(); } } }
void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.DisplayName)) { displayName = this.Contact.GetContactInformation(ContactInformationType.DisplayName).ToString(); if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("DisplayName")); } } }
void OnContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { try { ShowPresence(sender as Contact); } catch (Exception) { Cleanup(); } }
private void _Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.DisplayName)) { _ContactName = (string)_Contact.GetContactInformation(ContactInformationType.DisplayName); } if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { _ContactAvailability = (int)(ContactAvailability)_Contact.GetContactInformation(ContactInformationType.Availability); } }
/// <summary> /// Handler for the ContactInformationChanged event of the contact. Used to update the contact's information in the user interface. /// </summary> private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Only update the contact information in the user interface if the client is signed in. //Ignore other states including transitions (e.g. signing in or out). if (lyncClient.State == ClientState.SignedIn) { if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { //Use the current dispatcher to update the contact's availability in the user interface. SetAvailability(); } } }
/// <summary> /// This method is called when the ContactInformationChangedEvent is triggered, and will trigger this event if the location of the monitored user has changed. /// </summary> private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { var contact = sender as Contact; string selectedLocation = contact.GetContactInformation(ContactInformationType.LocationName).ToString(); // If the new location name is different from the previous one, we trigger the event. if (e.ChangedContactInformation.Contains(ContactInformationType.LocationName) && !currentLocation.ToLower().Equals(selectedLocation.ToLower())) { Trigger(); currentLocation = selectedLocation; } }
private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { // check to see if client is signed-in if (_lyncClient.State != ClientState.SignedIn) { NotifyAvailability(ContactAvailability.Offline); // this is important, because if the user signs out, we actually get notified, then die return; } var availability = (ContactAvailability)_lyncClient.Self.Contact.GetContactInformation(ContactInformationType.Availability); NotifyAvailability(availability); }
/// <summary> /// Callback, called by lync /// </summary> /// <param name="sender">Sender</param> /// <param name="e">ContactInformationChangedEventArgs</param> void CallbackContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (!sendEvent) { return; } if (!e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { return; } SendState(); }
// https://rcosic.wordpress.com/2011/11/17/availability-presence-in-lync-client/ private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { var caObj = _lyncClient?.Self?.Contact?.GetContactInformation(ContactInformationType.Availability); var ca = ContactAvailability.None; if (caObj != null) { ca = (ContactAvailability)caObj; } var modelContactAvaliability = ca.ToContactAvaliability(); InvokeConactInformstionStatusChanged(modelContactAvaliability); } }
/// <summary> /// Handler for the ContactInformationChanged event of the contact. Used to update the contact's information in the user interface. /// </summary> private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Only update the contact information in the user interface if the client is signed in. //Ignore other states including transitions (e.g. signing in or out). if (lyncClient.State == ClientState.SignedIn) { //Get from Lync only the contact information that changed. if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { //Use the current dispatcher to read the contact's availability on the UI thread dispatcher.BeginInvoke(new Action(GetAvailability)); } } }
/// <summary> /// This method is called when the ContactInformationChangedEvent is triggered, and will trigger this event if the previous status equals the status that is monitored. /// </summary> private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { var contact = sender as Contact; if (e.ChangedContactInformation.Contains(ContactInformationType.Activity)) { string contactStatus = contact.GetContactInformation(ContactInformationType.Activity).ToString(); if ((status.ToLower().Equals("any") || currentStatus.ToLower().Equals(status.ToLower())) && !contactStatus.ToLower().Equals(status.ToLower())) { Trigger(); } currentStatus = contactStatus; } }
private void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (lc.State == ClientState.SigningOut || lc.State == ClientState.SignedOut || lc.State == ClientState.SigningIn) { LogitechGSDK.LogiLedRestoreLighting(); return; } Contact self = sender as Contact; if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { ContactAvailability availability = (ContactAvailability)self.GetContactInformation(ContactInformationType.Availability); ChangeColor(availability); } }
static void SkypeSelfStateChenged(object sender, ContactInformationChangedEventArgs e) { try { foreach (ContactInformationType contactInfoType in e.ChangedContactInformation) { switch (contactInfoType) { case ContactInformationType.Availability: UpdateSkypeAvilability(); break; } } } catch (Exception Ex) { Logger.Log(Ex.Message, Logger.LEVEL.ERROR); } }
/// <summary> /// 参会人状态更改捕获 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { try { //使用异步委托 Application.Current.Dispatcher.BeginInvoke(new Action(() => { //判断是否有lync实例并判断其实例的状态 if (ConversationCodeEnterEntity.lyncClient != null && ConversationCodeEnterEntity.lyncClient.State == ClientState.SignedIn) { //获取联系人 Contact contact = sender as Contact; if (contact != null) { //获取相关人的邮箱地址列表 System.Collections.Generic.List <object> list = (System.Collections.Generic.List <object>)contact.GetContactInformation(ContactInformationType.EmailAddresses); //邮箱地址列表数量不为零 if (list.Count > 0 && currentParticipantsEntityList != null) { List <ParticipantsEntity> participantsEntityTempList = currentParticipantsEntityList.Where(item => item.LoginUri.ToLower().Equals(Convert.ToString(list[0]).ToLower())).ToList <ParticipantsEntity>(); if (participantsEntityTempList.Count > 0) { //获取对应参会人 ParticipantsEntity Participant = participantsEntityTempList[0]; //填充信息辅助 FillLyncOnlineInfoHelper(contact, Participant); } //返回参会人信息 if (BeginRefleshDataGridCallBack != null) { BeginRefleshDataGridCallBack(currentParticipantsEntityList); } } } } })); } catch (Exception ex) { LogManage.WriteLog(typeof(LyncHelper), ex); } }
void contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { OnPresenceChanged(GetPresence()); } if (e.ChangedContactInformation.Contains(ContactInformationType.PersonalNote)) { OnActivityChanged(GetPersonalNote()); } if (e.ChangedContactInformation.Contains(ContactInformationType.DisplayName)) { OnDisplayNameChanged(GetDisplayName()); } if (e.ChangedContactInformation.Contains(ContactInformationType.Photo)) { OnPhotoChanged(GetPhoto()); } }
private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { foreach (ContactInformationType changedInformationType in e.ChangedContactInformation) { if (changedInformationType == ContactInformationType.Availability) { UpdateBuddiesColor(); } } }
void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { string returnValue = string.Empty; StringBuilder sb = new StringBuilder(); Boolean raiseUpdate = false; if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { //get actual contactModel availability (Will be int value within OCOM availaiblity ranges) ContactAvailability availEnum = (ContactAvailability)((Contact)sender).GetContactInformation(ContactInformationType.Availability); string activityString = (string)((Contact)sender).GetContactInformation(ContactInformationType.Activity); sb.Append(availEnum.ToString() + " " + activityString); raiseUpdate = true; } if (raiseUpdate) { returnValue = "Updated availability for " + ((Contact)sender).GetContactInformation(ContactInformationType.DisplayName).ToString() + System.Environment.NewLine + sb.ToString(); } Dictionary<PublishableContactInformationType, object> publishState = new Dictionary<PublishableContactInformationType, object>(); publishState.Add(PublishableContactInformationType.Availability, ContactAvailability.Free); writeMessage("simulate mouse click" + DateTime.Now.ToString()); DoMouseClick(); //_lyncClient.Self.BeginPublishContactInformation(publishState, publishState_callback, null); }
/// <summary> /// Updates UI when there is a change in Lync, Lync => App /// </summary> private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Only update the contact information in the user interface if the client is signed in. //Ignore other states including transitions (e.g. signing in or out). if (lyncClient.State == ClientState.SignedIn) { //Get from Lync only the contact information that changed. if (e.ChangedContactInformation.Contains(ContactInformationType.PersonalNote)) { //Use the current dispatcher to update the contact's personal note in the user interface. dispatcher.BeginInvoke(new Action(SetPersonalNote)); } } }
private void SelfContact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { //Only update the contact information in the user interface if the client is signed in. //Ignore other states including transitions (e.g. signing in or out). if (lyncClient.State == ClientState.SignedIn) { //Get from Lync only the contact information that changed. if (e.ChangedContactInformation.Contains(ContactInformationType.Availability)) { //Use the current dispatcher to update the contact's availability in the user interface. SetAvailability(); } } }
/// <summary> /// lync 联系人信息变化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { try { Contact contact = (sender as Contact); if (_Client.Self.Contact == null) { return; } ContactAvailability availability = (ContactAvailability)contact.GetContactInformation(ContactInformationType.Availability);//Get the current availability value from Lync UCContactAvailability ucAvailability = GetUCState(availability); LogInBusiness log = new LogInBusiness(); log.PubSelfStatus((int)ucAvailability, new StringBuilder()); } catch (System.Exception ex) { LogManager.SystemLog.Error(ex.ToString()); } }
void contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { try { int i = e.ChangedContactInformation.IndexOf(ContactInformationType.Availability); if (i >= 0) { Contact contact = (Contact)sender; Microsoft.Lync.Model.ContactAvailability availability = (Microsoft.Lync.Model.ContactAvailability)contact.GetContactInformation(ContactInformationType.Availability); string Name = (string)contact.GetContactInformation(ContactInformationType.DisplayName); for (int rowIndex = 0; rowIndex < dataGridView.Rows.Count; rowIndex++) { if ((string)dataGridView.Rows[rowIndex].Cells["User"].Value == Name) { dataGridView.Rows[rowIndex].Cells["Status"].Value = availability.ToString(); dataGridView.Rows[rowIndex].Cells["Change Time"].Value = DateTime.Now.ToString("hh:mm:ss tt dd-MMM"); dataGridView.Rows[rowIndex].Cells["State Time"].Value = "0"; break; } } } } catch (NotSignedInException ex) { if (lyncClient.State != ClientState.SignedIn) { MessageBox.Show("Waiting for Lync to sign in\r\n"+ex.Message); System.Threading.Thread.Sleep(10000); } } }
void Contact_ContactInformationChanged(object sender, ContactInformationChangedEventArgs e) { doUpdate = true; }