Lync 2013을 사용하고 websocket을 통해 서버와 통신하고 알림을받는 내 응용 프로그램입니다. 이러한 알림은 Json 형식이므로 문자열을 추출하도록 변환합니다. 문자열은 전화 번호이며 내 연락처 중 하나가 자신의 이름을 표시하기 위해 동일한 전화 번호인지 테스트하려고합니다.ContactEndpoint 전화, Lync 2013
내 If는 항상 "거짓"입니다. >를 사용하고 DisplayName의 값 (문자열로 전화 번호)을 추출하려고했지만 어떻게해야할지 몰랐습니다. 이것은 내 코드입니다.
foreach (var group in client.ContactManager.Groups)
{
foreach (Contact contact in group)
{
List<object> endpoints = (List<object>)contact.GetContactInformation(ContactInformationType.ContactEndpoints);
List<object> phoneNumbers = endpoints.Cast<object>().Where<object>(N => ((ContactEndpoint)N).Type == ContactEndpointType.HomePhone ||
((ContactEndpoint)N).Type == ContactEndpointType.MobilePhone ||
((ContactEndpoint)N).Type == ContactEndpointType.WorkPhone ||
((ContactEndpoint)N).Type == ContactEndpointType.OtherPhone).ToList();
if (phoneNumbers.ToList().Contains(call.caller))
{
MessageBox.Show(contact.GetContactInformation(ContactInformationType.DisplayName).ToString());
}
}
}
나는 해결책을 찾았다 고 생각합니다. foreach는 (PHONENUMBERS에 var에 PHONENUMBER) \t \t \t \t \t \t \t { \t \t \t \t \t \t \t \t 경우 (== "내 전화 번호를 수신"((ContactEndpoint) PHONENUMBER) .DisplayName.ToString()) \t \t \t \t \t \t \t \t { \t \t \t \t \t \t \t \t \t MessageBox.Show (Contact.GetContactInformation (ContactInformationType.DisplayName) .ToString()); \t \t \t \t \t \t \t \t} \t \t \t \t \t \t \t은} –