Beispiel #1
0
        public async Task Save_And_Load_AppState_As_Xml()
        {
            AppState state = new AppState();

            state.Devices = new ObservableCollection <Device>();
            state.Devices.Add(new Intertechno("A", "3"));
            state.Devices.Add(new Intertechno("A", "4"));
            state.Devices.Add(new Intertechno("A", "5"));

            string filename = "testdata_settings.xml";

            await XMLStorage.SaveObjectToXmlByFileName(state, filename);

            var file = await ApplicationData.Current.LocalFolder.GetFileAsync(filename);

            var result = await XMLStorage.ReadObjectFromXmlFileAsync <AppState>(file);

            Assert.AreEqual(3, result.Devices.Count);
            Assert.AreEqual("A", result.Devices.FirstOrDefault().Masterdip);
            Assert.AreEqual("3", result.Devices.FirstOrDefault().Slavedip);
        }
Beispiel #2
0
    public static List <T> Load <T>(IItem item)
    {
        XMLStorage xmlStorage = new XMLStorage();

        return(xmlStorage.Load <T>(item));
    }