Beispiel #1
0
        public void AddedCurrenciesChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            //This will get called when the currencies change
            StringWriter  sw         = new StringWriter();
            XmlTextWriter tw         = null;
            XmlSerializer serializer = new XmlSerializer(typeof(Currencies));

            tw = new XmlTextWriter(sw);
            serializer.Serialize(tw, selectedCurrencies);
            SaveAndLoad.SaveText("selectedcurrencies.xml", sw.ToString());
        }
Beispiel #2
0
        public void ContactsChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            //This will get called when the currencies change
            StringWriter  sw         = new StringWriter();
            XmlTextWriter tw         = null;
            XmlSerializer serializer = new XmlSerializer(typeof(Contacts));

            tw = new XmlTextWriter(sw);
            serializer.Serialize(tw, this);
            SaveAndLoad.SaveText("contacts.xml", sw.ToString());

            UpdateFilteredContacts(ContactList);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }