Ejemplo n.º 1
0
        private void Address_Click(object sender, RoutedEventArgs e)
        {
            var contract = new AddressRequest
            {
                Cep = Cep.Text
            };

            var addressClient = new AddressClient();
            var addressInfo   = Task.Run(() => addressClient.GetAddressInfo(contract)).Result;

            if (addressInfo != null && string.IsNullOrWhiteSpace(addressInfo.Uf))
            {
                AddressInfo.Text = "Erro ao recuperar os dados do endereço";
                return;
            }

            AddressInfo.Text = $"{addressInfo.Logradouro}\n{addressInfo.Bairro} / {addressInfo.Localidade} / {addressInfo.Uf}\n{addressInfo.Cep}";
        }