Skip to main content

Microsoft Silverlight

Answered Question Appl ResourceRSS Feed

(0)

sunil.n.cs
sunil.n.cs

Member

Member

16 points

66 Posts

Appl Resource

 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
vikasamin

Member

Member

126 points

23 Posts

Answered Question

Re: Appl Resource

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

Vikas Amin

sunil.n.cs
sunil.n.cs

Member

Member

16 points

66 Posts

Answered Question

Re: Appl Resource

 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.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities