Ejemplo n.º 1
0
        private void UpdateXml(Sensors sensors)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Sensors));
            TextWriter    writer     = new StreamWriter("sensors.xml");

            serializer.Serialize(writer, sensors);
            writer.Close();
        }
Ejemplo n.º 2
0
 public MainPage(ref Button button, Action <Sensors> action, ref Sensors sensors) : this()
 {
     mapButton               = button;
     updateXml               = action;
     this.sensors            = sensors;
     radTileList.ItemsSource = sensors.List.
                               Where(item => item.Followed);
 }
Ejemplo n.º 3
0
        private void InitializeList()
        {
            sensors = new Sensors();

            XmlSerializer serializer = new XmlSerializer(typeof(Sensors));

            FileStream fs;

            if (!File.Exists("sensors.xml"))
            {
                using (StreamWriter sw = new StreamWriter("sensors.xml"))
                {
                    serializer.Serialize(sw, sensors);
                }
            }

            fs      = new FileStream("sensors.xml", FileMode.Open);
            sensors = (Sensors)serializer.Deserialize(fs);
            fs.Close();
        }