Exemplo 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)
            { }
        }
Exemplo 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";
                string sta   = "ON";
                if (curr.sensor_1 == false)
                {
                    sta = "OFF"; color = "#FFFF0000";
                }
                states.Add(new States("Device#1: " + sta, color, "", "", "" + " minutes"));
                // dt1 = curr.last1_2.Value.DateTime;
                // dt0 = curr.last0_2.Value.DateTime;
                // ts = dt1.Subtract(dt0);
                sta = "ON"; color = "#FF00FF00";
                if (curr.sensor_2 == false)
                {
                    sta = "OFF"; color = "#FFFF0000";
                }
                states.Add(new States("Device#2: " + sta, color, "", "", "" + " minutes"));
                //  dt1 = curr.last1_3.Value.DateTime;
                //  dt0 = curr.last0_3.Value.DateTime;
                //  ts = dt1.Subtract(dt0);
                sta = "ON"; color = "#FF00FF00";
                if (curr.sensor_3 == false)
                {
                    sta = "OFF"; color = "#FFFF0000";
                }
                states.Add(new States("Device#3: " + sta, color, "", "", "" + " minutes"));
                Sensors.ItemsSource = states;
            }
            catch (Exception) { }
        }