Пример #1
0
        private void BuscarCEP(object sender, EventArgs args)
        {
            // TODO - Lógica do programa


            // TODO - Validações


            string cep = CEP.Text.Trim();

            if (isValidCEP(cep))
            {
                try
                {
                    // TODO = Buscar serviço
                    Endereco end = ViaCEPServico.BuscaEnderecoViaCep(cep);
                    if (end != null)
                    {
                        RESULTADO.Text = string.Format("Endereço: {0} - {1} - {2}/{3}", end.logradouro, end.bairro, end.localidade, end.uf);
                    }
                    else
                    {
                        DisplayAlert("ERRO", "Oendereço não foi encontrado para o CEP informado: " + cep, "OK");
                    }
                }
                catch (Exception e)
                {
                    DisplayAlert("ERRO CRITICO", e.Message, "OK");
                }
            }
        }