예제 #1
0
        public async Task <List <Car> > GetCars()
        {
            var Service = new Services.AzureServices <Car>();
            var Items   = await Service.GetTable();

            return(Items.ToList());
        }
예제 #2
0
        async void EnviarAzure(Luminosidade novoValor)
        {
            if (!IsBusy)
            {
                Exception Error = null;
                try
                {
                    IsBusy = true;
                    var AzureService = new Services.AzureServices <Luminosidade>();
                    await AzureService.Enviar(novoValor);
                }
                catch (Exception ex)
                {
                    Error = ex;
                }

                finally
                {
                    IsBusy = false;
                }
                if (Error != null)
                {
                    await App.Current.MainPage.DisplayAlert("Erro!", Error.Message, "Ok");
                }
            }

            return;
        }
예제 #3
0
        public async Task <List <Cat> > GetCatsAzure()
        {
            //Instancia serviço do azure
            var AzureServices = new Services.AzureServices <Cat>();
            //Espera pegar os valores de tabelas
            var AzureItems = await AzureServices.GetTable();

            //retorna os valores de tabela como List<T>
            return(AzureItems.ToList());
        }
예제 #4
0
        public async Task <List <Cat> > GetCats()
        {
            // Utilizando Meu RestFull Azure
            var Service = new Services.AzureServices <Cat>();
            var Items   = await Service.GetTable();

            return(Items.ToList());


            // Utilizando o RestFull da Maratona Xamarin

            //List<Cat> Cats;
            //var URLWebAPI = "http://demos.ticapacitacion.com/cats";

            //using (var Client = new System.Net.Http.HttpClient())
            //{
            //   var JSON = await Client.GetStringAsync(URLWebAPI);
            //   Cats = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Cat>>(JSON);
            //}
            //return Cats;
        }