ItemSource from XML file in IsolatedStorage

2 posts, 0 answers
  1. Justin
    Justin avatar
    15 posts
    Member since:
    Jan 2012

    Posted 16 Aug 2013 Link to this post

    I'm trying to bind the JumpList to a XML file from IsolatedStorage. Some of my code is below, but It doesn't seem to be working. What am I doing wrong?

    public IEnumerable<Phones> GetSavedData()
    {
        IEnumerable<Phones> phoneList = new List<Phones>();
     
        try
        {
            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                string offlineData = Path.Combine("WPTracker", "Offline");
                string offlineDataFile = Path.Combine(offlineData, "phones.xml");
                IsolatedStorageFileStream isoFileStream = myIsolatedStorage.OpenFile(offlineDataFile, FileMode.Open);
     
                if (myIsolatedStorage.FileExists(offlineDataFile))
                {
                    using (XmlReader xmlReader = XmlReader.Create(isoFileStream))
                    {
                        XmlSerializer deserializer = new XmlSerializer(typeof(List<Phones>));
                        List<Phones> phones = deserializer.Deserialize(xmlReader) as List<Phones>;
     
                        phones.Sort(
                            new Comparison<Phones>((Phones p1, Phones p2) =>
                            {
                                return p1.FullName.CompareTo(p2.FullName);
                            }));
     
                        this.radJumpList1.ItemsSource = phones;
     
                        return phones;
                    }
                }
                else
                {
                    var update = new UpdateDatabase();
                    update.UpdateData();
     
                    GetSavedData();
                }
            }
        }
        catch (IsolatedStorageException)
        {
            MessageBox.Show("There was an error retireving the data from Isolated Storage.", "The subscriber you are trying to reach can not be located.", MessageBoxButton.OK);
        }
     
        return phoneList;           
    }
  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 21 Aug 2013 Link to this post

    Hi Justin,

    Thanks for writing.

    In general, the code you've pasted looks correct. Can you please share some further details what exactly happens on your side? Do you see any items or you don't see any items at all?

    Is it possible for you to send me a sample project that reproduces the issues you experience so that I can directly take a look and help you out?

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top