private Abstractions.PhoneType Convert(ContactPhoneKind kind) { Abstractions.PhoneType type = Abstractions.PhoneType.Other; switch (kind) { case ContactPhoneKind.Home: type = Abstractions.PhoneType.Home; break; case ContactPhoneKind.Mobile: type = Abstractions.PhoneType.Mobile; break; case ContactPhoneKind.Company: case ContactPhoneKind.Work: type = Abstractions.PhoneType.Work; break; case ContactPhoneKind.Other: break; case ContactPhoneKind.Pager: break; case ContactPhoneKind.BusinessFax: type = Abstractions.PhoneType.WorkFax; break; case ContactPhoneKind.HomeFax: type = Abstractions.PhoneType.HomeFax; break; } return(type); }
/// <summary> /// Utility method to convert phone information from the WinRT ContactPhoneKind /// instance to the representation in the vCard library. /// No 1:1 matching is possible between both classes, the method tries to /// keep the conversion as accurate as possible. /// </summary> /// <param name="phoneKind">Phone information from WinRT.</param> /// <returns>The phone information from WinRT library converted to a /// vCard library class instance.</returns> private vCardPhoneTypes ConvertPhoneTypeToVcard(ContactPhoneKind phoneKind) { switch (phoneKind) { case ContactPhoneKind.Home: return(vCardPhoneTypes.HomeVoice); case ContactPhoneKind.Mobile: return(vCardPhoneTypes.CellularVoice); case ContactPhoneKind.Work: return(vCardPhoneTypes.WorkVoice); case ContactPhoneKind.Other: return(vCardPhoneTypes.Voice); default: return(vCardPhoneTypes.Voice); } }
public static Abstractions.PhoneType ToPhoneType(this ContactPhoneKind value) { switch (value) { case ContactPhoneKind.Home: return(Abstractions.PhoneType.Home); case ContactPhoneKind.Mobile: return(Abstractions.PhoneType.Mobile); case ContactPhoneKind.Work: return(Abstractions.PhoneType.Work); case ContactPhoneKind.Other: return(Abstractions.PhoneType.Other); case ContactPhoneKind.Pager: return(Abstractions.PhoneType.Pager); case ContactPhoneKind.BusinessFax: return(Abstractions.PhoneType.WorkFax); case ContactPhoneKind.HomeFax: return(Abstractions.PhoneType.HomeFax); case ContactPhoneKind.Company: return(Abstractions.PhoneType.Other); case ContactPhoneKind.Assistant: return(Abstractions.PhoneType.Other); case ContactPhoneKind.Radio: return(Abstractions.PhoneType.Other); default: throw new ArgumentOutOfRangeException(nameof(value)); } }
/// <summary> /// Utility method to convert phone information from the WinRT ContactPhoneKind /// instance to the representation in the vCard library. /// No 1:1 matching is possible between both classes, the method tries to /// keep the conversion as accurate as possible. /// </summary> /// <param name="phoneKind">Phone information from WinRT.</param> /// <returns>The phone information from WinRT library converted to a /// vCard library class instance.</returns> private vCardPhoneTypes ConvertPhoneTypeToVcard(ContactPhoneKind phoneKind) { switch (phoneKind) { case ContactPhoneKind.Home: return vCardPhoneTypes.HomeVoice; case ContactPhoneKind.Mobile: return vCardPhoneTypes.CellularVoice; case ContactPhoneKind.Work: return vCardPhoneTypes.WorkVoice; case ContactPhoneKind.Other: return vCardPhoneTypes.Voice; default: return vCardPhoneTypes.Voice; } }
static ContactType GetPhoneContactType(ContactPhoneKind type) => type switch {