Beispiel #1
0
        private void BuscarCep(object sender, EventArgs e)
        {
            string cep = txtCep.Text.Trim();

            if (isValidCep(cep))
            {
                try
                {
                    Endereco end = ConsultaCep.BuscarEnderecoViaCep(cep);

                    if (end != null)
                    {
                        txtEndereco.Text = string.Format("{0},{1},{2},{3}", end.logradouro, end.bairro, end.localidade, end.uf);
                    }
                    else
                    {
                        DisplayAlert("Error", "Endereço não encontrado!", "OK");
                    }
                }
                catch (Exception ex)
                {
                    DisplayAlert("Error", ex.Message, "OK");
                }
            }
        }