This is a migrated thread and some comments may be shown as answers.

ItemSource from XML file in IsolatedStorage

1 Answer 50 Views
JumpList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Justin
Top achievements
Rank 1
Justin asked on 17 Aug 2013, 04:03 AM
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;           
}

1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 21 Aug 2013, 02:46 PM
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.
Tags
JumpList
Asked by
Justin
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Share this question
or