WP7 如何在 TombStoning 期间存储 LiveConnectSession? [英] WP7 how to store LiveConnectSession during TombStoning?

查看:23
本文介绍了WP7 如何在 TombStoning 期间存储 LiveConnectSession?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MS 提供的 PhotoSkyOnTheGo 示例的 windows 实时登录策略.因此,当我的应用启动时,它会显示一个 Windows Live 登录页面.

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.

在应用运行时,我记得 LiveConnectSession 连接到 SkyDrive.

During app runtime I remember the LiveConnectSession to connect to SkyDrive.

现在当应用程序逻辑删除时,我需要一种方法来保存 LiveConnectSession.IndependentStorageSettings.ApplicationSettings 不起作用,可能是因为 LiveConnectSession 不可序列化(它在调试输出中显示了一些 InvalidDataContractException).

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).

那么如果应用程序墓碑,我如何存储会话?还是提供的 PhotoSkyOnTheGo 示例是垃圾,我需要在访问 SkyDrive 时随时重新连接?

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?

推荐答案

如果您的应用使用 wl.offline_access 范围,那么 live:SignInButton 控件会为您保存它并自动加载它.只需使用 SessionChanged 事件来捕获会话对象.这样,用户只需登录一次.

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.

范围:http://msdn.microsoft.com/en-us/library/live/hh243646.aspx#wlofflineaccess

事件:http://msdn.microsoft.com/en-us/library/live/microsoft.live.controls.signinbutton.sessionchanged.aspx

这篇关于WP7 如何在 TombStoning 期间存储 LiveConnectSession?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆