Exemple #1
0
        private void BuscarCEP(object sender, EventArgs args)
        {
            string cep = entCEP.Text.Trim();

            if (ValidarCEP(cep))
            {
                try
                {
                    Endereco end = ViaCepServico.BuscarEnderecoCEP(cep);

                    if (end != null)
                    {
                        lblResultado.Text = string.Format("Endereço: {0}, {1}, {2} \r\n{3} ", end.localidade, end.uf, end.logradouro, end.bairro);
                    }
                    else
                    {
                        DisplayAlert("ERRO", "CEP Inexistete", "OK");
                    }
                }
                catch (Exception e)
                {
                    DisplayAlert("ERRO CRÍTICO", e.Message, "OK");
                }
            }
        }