private void ReformatPhoneNumber() { CountryGetFormatsCountryRow formatsCountryRow = GetCountryFormatsCountryRow(this._countryFormats, this._countryid.Value); this._number.FormatCode = formatsCountryRow == null ? PhoneFormat.Unformatted : (PhoneFormat)Conversions.ToInteger(Enum.Parse(typeof(PhoneFormat), formatsCountryRow.PhoneFormatCode.ToString((IFormatProvider)CultureInfo.InvariantCulture))); if (this._number.Value == null) { return; } this._number.Value = this._number.GetFormattedPhoneNumber(this._number.Value); }
internal static CountryGetFormatsCountryRow GetCountryFormatsCountryRow(CountryGetFormatsReply countryFormats, Guid countryID) { List <CountryGetFormatsCountryRow> .Enumerator enumerator; enumerator = countryFormats.Countries.GetEnumerator(); try { while (enumerator.MoveNext()) { CountryGetFormatsCountryRow current = enumerator.Current; if (current.ID == countryID) { return(current); } } } finally { enumerator.Dispose(); } return((CountryGetFormatsCountryRow)null); }