I have some property OwnerId that has each page in my application. I need these property to create HttpWebRequest and get some data. But when the application deactivated and activated again the page as deleted and created again, so these property is 0. I can't save these property in PhoneApplicationPage.State , because these property is different for different pages, so when I go twice back I can get error. I think to take it property after application activated from NavigationService.BackStack pages.But I'm not sure it is right. How can I do it ?

有帮助吗?

解决方案

Aram .. thanks for explaining the question better.

Now, while your application is in the foreground, how are you managing all these different OwnerIDs? A collection? I am guessing you don't have multiple instances of the same page; but rather pass query parameters along to indicate which OwnerID/UserID should be used to display appropriate user info. You could put the whole collection in State dictionaries with a key & hydrate/dehydrate during the application lifecycle. Makes sense?

Thanks!

其他提示

I'm not 100% clear on whether you need a setting for each page or just a single setting for the app. In either case your best option (IMO) is IsolatedStorageSettings (http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragesettings(v=vs.95).aspx)

If you just need a single setting then there's no problem but if you need one for each page you will need to do something ugly like using the page name as the key.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top