Example #1
0
        private void BuscarCep(object sender, EventArgs args)
        {
            string cep = Cep.Text.Trim();

            if (isValidCep(cep))
            {
                try
                {
                    Endereco end = ViaCepServico.BuscarEndereco(cep);
                    if (end != null)
                    {
                        Resultado.Text = end.ToString();
                    }
                    else
                    {
                        DisplayAlert("ERRO", "CEP inválido! Endereço não encontrado para o CEP informado: " + cep, "OK");
                    }
                }
                catch (Exception e)
                {
                    DisplayAlert("ERRO CRÍTICO", e.Message, "OK");
                }
            }
        }