Пример #1
0
        private void BuscarCep(object sender, EventArgs args)
        {
            string cep = txtName.Text.Trim();

            if (isValidCep(cep))
            {
                try
                {
                    Address end = ViaCepService.SearchAddressViaCep(cep);
                    if (end != null)
                    {
                        lbResultado.Text = string.Format("Endereço: {0}, {1}, {2}-{3}", end.logradouro, end.bairro, end.localidade, end.uf);
                    }
                    else
                    {
                        DisplayAlert("Erro", "O Endereço não foi encontrado para o cep encontrado: " + cep, "OK");
                    }
                }
                catch (Exception e)
                {
                    DisplayAlert("Erro Critico", e.Message, "OK");
                }
            }
        }