Exemplo n.º 1
0
        public async Task <List <HouseData> > GetHouseHoldData()
        {
            List <HouseData> hd = new List <HouseData>();

            int i = 0;
            FirebaseResponse resp1 = await client.GetTaskAsync("Counter/House");

            Counter_Class obj1 = resp1.ResultAs <Counter_Class>();

            int cnt = Convert.ToInt32(obj1.cnt);

            while (true)
            {
                if (i == cnt)
                {
                    break;
                }

                i++;
                try
                {
                    FirebaseResponse resp2 = await client.GetTaskAsync("House/" + i);

                    HouseData obj2 = resp2.ResultAs <HouseData>();
                    hd.Add(obj2);
                }
                catch
                {
                }
            }
            return(hd);
        }
Exemplo n.º 2
0
        public async Task <List <FridgeData> > GetFridgeData()
        {
            List <FridgeData> fd = new List <FridgeData>();

            int i = 0;
            FirebaseResponse resp1 = await client.GetTaskAsync("Counter/Fridge");

            Counter_Class obj1 = resp1.ResultAs <Counter_Class>();

            int cnt = Convert.ToInt32(obj1.cnt);

            while (true)
            {
                if (i == cnt)
                {
                    break;
                }

                i++;
                try
                {
                    FirebaseResponse resp2 = await client.GetTaskAsync("Fridge/" + i);

                    FridgeData obj2 = resp2.ResultAs <FridgeData>();
                    fd.Add(obj2);
                }
                catch
                {
                }
            }
            return(fd);
        }
Exemplo n.º 3
0
        private async void SetNewCounter(String ID, String function)
        {
            var obj = new Counter_Class
            {
                cnt = ID
            };

            SetResponse resp1 = await client.SetTaskAsync("Counter/" + function, obj);
        }
Exemplo n.º 4
0
        private async Task <String> GetCounter(String Function)
        {
            String ID = "0";

            FirebaseResponse resp = await client.GetTaskAsync("Counter/" + Function);

            Counter_Class get = resp.ResultAs <Counter_Class>();

            ID = (Convert.ToInt32(get.cnt) + 1).ToString();

            return(ID);
        }