Ejemplo n.º 1
0
        public PageVoirContact()
        {
            InitializeComponent();



            using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (store.FileExists("Agenda/contact.xml"))
                {
                    using (IsolatedStorageFileStream fileStream = store.OpenFile("Agenda/contact.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(ListeContacts));
                        listecontact = serializer.Deserialize(fileStream) as ListeContacts;
                    }
                }
                else
                {
                    listecontact = new ListeContacts();
                }
            }

            foreach (var unContact in listecontact.Items)
            {
                mesContacts.Add(unContact);
            }

            listcontact.ItemsSource = mesContacts;
        }
        public GestionContact()
        {
            InitializeComponent();



            using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (store.FileExists("Agenda/contact.xml"))
                {
                    using (IsolatedStorageFileStream fileStream = store.OpenFile("Agenda/contact.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(ListeContacts));
                        listeContact = serializer.Deserialize(fileStream) as ListeContacts;
                    }
                }
                else
                {
                    listeContact = new ListeContacts();
                }
            }


            AffichageCollections();
        }