public PageContact() { //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 AjouterContact() { 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(); } } InitializeComponent(); }