LIVE SDK v5.3 &窗口 8 - 如何区分使用 Microsoft 帐户登录的用户和使用本地帐户登录的用户? [英] LIVE SDK v5.3 & Window 8 - How to tell the difference between a user logged in with a Microsoft Account and user with a local account?

查看:28
本文介绍了LIVE SDK v5.3 &窗口 8 - 如何区分使用 Microsoft 帐户登录的用户和使用本地帐户登录的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 v5.3 Live SDK 用于 Windows 8 Store 应用程序 (XAML/C#),我有一个问题.

I'm using the v5.3 Live SDK for a Windows 8 Store App (XAML/C#) and I have a question.

  1. 在我的应用中,如果用户使用 Microsoft帐户,然后我想获取名字/姓氏/Microsoft ID.
  2. 如果他们使用本地帐户登录到 Windows 并且没有登录到我的应用程序,然后我想显示一个登录"按钮,所以他们可以输入他们的 Microsoft 帐户电子邮件/密码.

我知道如何使用 Live SDK 完成所有这些操作,但我的问题是 - 如何判断用户是使用 Microsoft 帐户登录 Windows 还是使用尚未登录 MS 帐户的本地帐户?

I know how to do all that using the Live SDK, but my question is - how can I tell if the user is logged into Windows with a Microsoft account versus a Local Account that hasn't been logged in to the MS account?

我可以使用以下内容:

var idAuth = new OnlineIdAuthenticator();
return idAuth.CanSignOut;

但如果上述 2 个条件为真,则返回 false(如果用户使用本地帐户,但已使用 Microsoft 帐户详细信息登录到我的应用,则返回 true).

but this will return false if either the 2 criteria above is true (and return true if the user is using a local account, but has logged in to my app using Microsoft account details).

理论上,如果以上返回false,我可以执行以下操作:

In theory, if the above returns false, I can do the following:

LiveAuthClient authClient = new LiveAuthClient();
LiveLoginResult authResult = await authClient.LoginAsync(new List<string>() { "wl.signin" });
if (authResult.Status == LiveConnectSessionStatus.Connected)
  { //Get user info here }

问题在于,这对于使用 Microsoft 帐户登录 Windows 的用户来说工作正常 - 他们的信息可以正常获取,但如果是使用本地帐户登录 Windows 的用户,那么它将显示 Live我的应用中的登录屏幕 - 那时我不想这样做,而只是在我的 UI 中显示一个登录按钮.

The problem is that this works fine for a user logged into windows using a Microsoft Account - their info is picked up fine, but if it is a user logged into Windows with a local account, then it is going to show the Live Login screen in my app - at that point I don't want to do that, rather just show a logon button in my UI.

有人知道如何区分上述 2 个标准之间的区别吗?

Anyone any ideas on how to tell the difference between the 2 criteria above?

感谢期待,理查德.

推荐答案

我最终在 MSDN 论坛上提出了同样的问题并在那里得到了答案,所以我将其发布在这里,以防对其他人有所帮助.

I ended up asking the same question on the MSDN forums and got an answer there, so I am posting it here just in case it helps anyone else.

http://social.msdn.microsoft.com/Forums/en-US/messengerconnect/thread/f6946851-‌ b495-45f6-95a4-eb3c2a004c0e

这篇关于LIVE SDK v5.3 &amp;窗口 8 - 如何区分使用 Microsoft 帐户登录的用户和使用本地帐户登录的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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