Esempio n. 1
0
        private void GetContacts()
        {
            if (!SaveAndLoad.FileExists(contactsXmlFileName))
            {
                XDocument xdoc = XDocument.Load(Android.App.Application.Context.Assets.Open(contactsXmlFileName));
                SaveAndLoad.SaveText(contactsXmlFileName, xdoc.ToString());
            }

            var xmlString = SaveAndLoad.LoadText(contactsXmlFileName);

            var serializer = new XmlSerializer(typeof(Contacts));
            var strReader  = new StringReader(xmlString);
            var xmlReader  = new XmlTextReader(strReader);
            var _contacts  = (Contacts)serializer.Deserialize(xmlReader);

            ContactList = new ObservableCollection <Contact>(_contacts.ContactList);
        }
Esempio n. 2
0
        private void GetSelectedCurrencies()
        {
            if (!SaveAndLoad.FileExists(selectedCurrenciesXmlFileName))
            {
                XDocument xdoc = XDocument.Load(Android.App.Application.Context.Assets.Open(selectedCurrenciesXmlFileName));
                SaveAndLoad.SaveText(selectedCurrenciesXmlFileName, xdoc.ToString());
            }

            var xmlString = SaveAndLoad.LoadText(selectedCurrenciesXmlFileName);

            var serializer = new XmlSerializer(typeof(Currencies));
            var strReader  = new StringReader(xmlString);
            var xmlReader  = new XmlTextReader(strReader);

            //XmlReader reader = XmlReader.Create(Android.App.Application.Context.Assets.Open(selectedCurrenciesXmlFileName));
            selectedCurrencies = (Currencies)serializer.Deserialize(xmlReader);
        }