Exemple #1
0
        public void save_JSON()
        {
            var list = new List <string>();

            foreach (Sensor a in Sensors)
            {
                if (a is Czujnik_temperatury)
                {
                    Czujnik_temperatury T = a as Czujnik_temperatury;
                    list.Add(T.valueT.ToString());
                }
                else if (a is Czujnik_cisnienia)
                {
                    Czujnik_cisnienia P = a as Czujnik_cisnienia;
                    list.Add(P.valueP.ToString());
                }
                else if (a is Czujnik_temperatury_i_wiglotnosci)
                {
                    Czujnik_temperatury_i_wiglotnosci TH = a as Czujnik_temperatury_i_wiglotnosci;
                    list.Add(TH.value_humidity.ToString());
                    list.Add(TH.value_temp.ToString());
                }
            }
            File.AppendAllText(@"C:\Users\Adam\Desktop\test.json", JsonConvert.SerializeObject(list, Formatting.Indented));
        }
Exemple #2
0
 public void PressureValue()
 {
     foreach (Sensor a in Sensors)
     {
         if (a is Czujnik_cisnienia)
         {
             Czujnik_cisnienia P = a as Czujnik_cisnienia;
             Console.WriteLine(P.valueP);
         }
     }
 }