Пример #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();
        }
Пример #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);
 }
Пример #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();
        }