Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 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();
 }