/// <summary> /// Obtains a contact using the URI provided. /// </summary> private void buttonSelect_Click(object sender, EventArgs e) { //gets the typed uri string uri = textBoxAddress.Text; //simple validation: ignores empty string if (string.IsNullOrEmpty(uri)) { Console.WriteLine("No URI specified"); return; } //***************************************************************************************** // contactManager.GetContactByUri // // This method will may return a contact, even if it doesn't match a phone number or a // SIP URI in the database. // // Calls placed using contact object that does not match a valid number or an actual contact // will fail after the modality starts connecting. // //***************************************************************************************** Contact contact = null; //Finds the contact using the provided URI (synchronously) try { contact = lyncContactManager.GetContactByUri(uri); } catch (LyncClientException lyncClientException) { Console.WriteLine("Contact not found. Did you use the sip: or tel: prefix? " + lyncClientException); } catch (SystemException systemException) { if (LyncModelExceptionHelper.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; } } //if there was somebody listening to the event ContactSelected onContactSelected = ContactSelected; if (contact != null && onContactSelected != null) { //notify that the contact was selected onContactSelected(this, contact); } }
public override void DidSelectContact(CNContactPickerViewController picker, CNContact contact) { ContactSelected?.Invoke(contact); }
internal void RaiseContactSelected(CNContact contact) { ContactSelected?.Invoke(contact); }