问题
I'm using the windows live sign in strategy of the PhotoSkyOnTheGo example provided by MS. So when my app starts, it shows a windows live sign in page.
During app runtime I remember the LiveConnectSession to connect to SkyDrive.
Now when the app tombstones, I need a way to save the LiveConnectSession. IsolatedStorageSettings.ApplicationSettings does not work, probably because the LiveConnectSession is not serializable (it shows some InvalidDataContractException in the debug output).
So how do I store the Session in case the app tombstones? Or is the provided PhotoSkyOnTheGo-example rubbish and I need to be able to reconnect anytime I'm accessing SkyDrive?
回答1:
If your app uses wl.offline_access
scope than the live:SignInButton
control saves it for you and loads it automatically. Just use the SessionChanged
event to capture the session object. This way the user will need to sign in only once.
Scope: http://msdn.microsoft.com/en-us/library/live/hh243646.aspx#wlofflineaccess
Event: http://msdn.microsoft.com/en-us/library/live/microsoft.live.controls.signinbutton.sessionchanged.aspx
来源:https://stackoverflow.com/questions/10946629/wp7-how-to-store-liveconnectsession-during-tombstoning