Esempio n. 1
0
        private async void readFile()
        {
            try
            {
                var item = await MobileService.GetTable <WaterFilter>().Take(1).OrderByDescending(e => e.CreatedAt).ToListAsync();

                if (item.Count != 0)
                {
                    curr = item[0];
                }
            }
            catch (Exception e)
            { }
        }
Esempio n. 2
0
        public async void refresh()
        {
            try
            {
                var item = await MobileService.GetTable <WaterFilter>().Take(1).OrderByDescending(e => e.CreatedAt).ToListAsync();

                if (item.Count != 0)
                {
                    curr = item[0];
                }
                //DateTime dt1 = curr.last1_1.Value.DateTime;
                //DateTime dt0 = curr.last0_1.Value.DateTime;
                // TimeSpan ts = dt1.Subtract(dt0);
                string color = "#FF00FF00";
                if (curr.sensor_1 == false)
                {
                    color = "#FFFF0000";
                }
                states.Add(new States("Device#1", color, "", "", "" + " minutes"));
                //dt1 = curr.last1_2.Value.DateTime;
                //dt0 = curr.last0_2.Value.DateTime;
                // ts = dt1.Subtract(dt0);
                color = "#FF00FF00";
                if (curr.sensor_2 == false)
                {
                    color = "#FFFF0000";
                }
                states.Add(new States("Device#1", color, "", "", "" + " minutes"));
                // dt1 = curr.last1_3.Value.DateTime;
                // dt0 = curr.last0_3.Value.DateTime;
                // ts = dt1.Subtract(dt0);
                color = "#FF00FF00";
                if (curr.sensor_3 == false)
                {
                    color = "#FFFF0000";
                }
                states.Add(new States("Device#1", color, "", "", "" + " minutes"));
                Sensors.ItemsSource = states;
            }
            catch (Exception) { }
        }