Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Appl Resource
2 replies. Latest Post by sunil.n.cs on November 7, 2009.
(0)
sunil.n.cs
Member
16 points
66 Posts
11-06-2009 4:17 AM |
Hi,
At the starting of the application i am retrieving a list of data using web service and keeping it in appl resource as shown below..
Private Sub webser_fnRoleCompleted(ByVal sen As Object, ByVal e As ServiceReference1.fnRoleCompletedEventArgs) If IsNothing(e.Result) = False Then If (App.Current.Resources.Contains("Roles")) Then App.Current.Resources.Remove("Roles") End If App.Current.Resources.Add("Roles", e.Result) End If End Sub
so that i can access this in another page later as follows..
Dim roles = App.Current.Resources("Roles")
Which works fine, but the problem is i can see the data present in it only in debug mode, and i cant querry out the data in it, like
roles.Result.Item(0).UserID
Can any1 plz help me out here, how can i keep a list of data in application resource and later access it.
Thanks in advance
vikasamin
126 points
23 Posts
11-06-2009 5:30 PM |
One solution is to use isolates storage system for making your data persistent
http://blog.structuretoobig.com/post/2009/04/13/Persisting-User-Settings-in-Silverlight.aspx
1: public static WorldmapsSettings Load()
2: {
3:
4: WorldmapsSettings settings = null;
5:
6: if (IsolatedStorageSettings.ApplicationSettings.Contains("foo"))
7: {
8: settings = IsolatedStorageSettings.ApplicationSettings["foo"] as WorldmapsSettings;
9: }
10:
11: if (settings == null)
12: {
13: settings = new WorldmapsSettings();
14: }
15:
16: return settings;
17: }
18:
19: public void Save()
20: {
21: IsolatedStorageSettings.ApplicationSettings["foo"] = this;
22: }
some other links
http://blogs.silverlight.net/blogs/msnow/archive/2008/07/16/tip-of-the-day-19-using-isolated-storage.aspx
http://www.ddj.com/web-development/208300036?pgno=2
http://blogs.silverlight.net/blogs/jesseliberty/archive/2008/09/29/isolated-storage-actually-it-s-easy.aspx
11-07-2009 1:31 AM |
Thanks a lot, i will surely try the method you have mentioned...and for the querry i have mentioned above, i had to cast it to its corresponding collection before assigning it. I did it and its working now.
Thanks for letting me know about the isolated storage method, it will be helpful for me.