コード例 #1
0
        private void ExecuteComandoClick()
        {
            string cep = CEP.Text();

            if (isValidCEP(cep))
            {
                try
                {
                    Endereco end = ViaCEPServico.BuscarEnderecoViaCEP(cep);

                    if (end != null)
                    {
                        RESULTADO.Text = String.Format("Endereço: {2} de {3} {0},{1} ", end.localidade, end.uf, end.logradouro, end.bairro);
                    }

                    else
                    {
                        App.Current.MainPage.DisplayAlert("ERRO", "O endereço não foi encontrado para o CEP informado: " + cep, "OK");
                    }
                }
                catch (Exception e)
                {
                    App.Current.MainPage.DisplayAlert("ERRO CRÍTICO", e.Message, "OK");
                }
            }
        }