Exemple #1
0
        public void Initialize()
        {
            using (var stream = documentService.GetStream(documentPartPath, MediaTypeNames.Text.Xml, FileMode.Open))
            {
                if (stream.Length == 0)
                {
                    root = new AddressBookRoot();
                    foreach (var contact in SampleDataProvider.CreateContacts())
                    {
                        root.AddContact(contact);
                    }
                }
                else
                {
                    root = (AddressBookRoot)serializer.Value.ReadObject(stream);
                }
            }

            navigationService.AddNavigationNode("Contacts", ShowAddressBook, CloseAddressBook, 2, 1);
        }