コード例 #1
0
        void AnalogTemperatureUpdated(object sender, Meadow.IChangeResult <Temperature> e)
        {
            Console.Write($"Saving ({e.New.Celsius},{DateTime.Now})...");

            var reading = new TemperatureTable()
            {
                TemperatureValue = e.New,
                DateTime         = DateTime.Now
            };

            DatabaseManager.Instance.SaveReading(reading);

            Console.WriteLine("done!");
        }
コード例 #2
0
        public bool SaveReading(TemperatureTable temperature)
        {
            if (isConfigured == false)
            {
                Console.WriteLine("SaveUpdateReading: DB not ready");
                return(false);
            }

            if (temperature == null)
            {
                Console.WriteLine("SaveUpdateReading: Conditions is null");
                return(false);
            }

            Console.WriteLine("Saving climate reading to DB");

            Database.Insert(temperature);

            Console.WriteLine($"Successfully saved to database");

            return(true);
        }