1. redbullqwe's Avatar

    I'm fairly new to windows phone programming.

    I need to store data on the phone when the app closes, and load the data when the app starts.

    Specificly BitmapImages, dictionaries of all types and simple integers, bool etc.

    At the moment i have implemented a different method for every different type of data, that converts the dictionary to json, and then saves it as a .json file on the phone.

    BitmapImages are of course not converted to json, they are saved in the way described in the WP documentary.

    This technique is very painful, because every time I need to save data thats of a new type, i have to implement a method for that first.

    Now my question, do you know any way to accomplish this task, thats more robust and flexible than mine?

    I found an article about a local database on WP here and I'm now experimenting a bit with that, but I'm not sure if it can really do what I want.

    I would really appreciate any help, because I have been stuck with this task a long time now ;)
    04-05-2013 03:32 AM
  2. WesternLights's Avatar
    Personally I make my custom classes serializable with [DataContract] keywords and save them using IsolatedStorageSettings. It seemed much easier to me than a local actual database. Example from my cPlayer application:

        public abstract class FileSystemItem : INotifyPropertyChanged
            public string _icon;
            public string _iconpath = "Resources/Icons/";
            public string guid = "";
            public string _title;
            public string _titlelower;
            public string _parentid;
            public string _id;
            public string _type;
            public string _actionurl;
            public bool _showcheckbox = false;
            public bool _selected = false;
            public string _information;
            public DateTime _lastplayed;
            public int _filesize;
            public List<SubtitlesItem> Subs { get; set; }
            //below are methods, they don't need to be seralized
    Instances of the above class are saved in IsolatedStorageSettings. RootItem, MediaServerItem, FolderItem, MovieItem, SubtitlesItem, UnknownFileItem are subclasses of FileSystemItem.
    04-05-2013 12:09 PM

Similar Threads

  1. Working with local database in background agent
    By vunder in forum Software Development and Hacking
    Replies: 0
    Last Post: 04-13-2012, 04:41 AM
  2. Xbox Live Leaderboards only show local score?
    By seaniccus in forum Other Operating Systems
    Replies: 1
    Last Post: 01-21-2011, 07:43 PM
  3. Bing Local search fix (outside the US)
    By fc000 in forum Other Operating Systems
    Replies: 1
    Last Post: 12-15-2010, 11:30 AM