LiveLoginResult.Status是未知的?

Kas*_*chi 8 .net c# windows-8 windows-store-apps

我正在尝试使用代码来确定用户是否已登录?

LiveAuthClient LCAuth = new LiveAuthClient();

LiveLoginResult LCLoginResult = await LCAuth.InitializeAsync();
Run Code Online (Sandbox Code Playgroud)

即使用户已登录,也会返回"未知".

这有什么问题?

Kas*_*chi 2

LiveAuthClient authCilent = new LiveAuthClient();

LiveLoginResult loginResult;

loginResult = authCilent.InitializeAsync().Result;

if (loginResult.Status == LiveConnectSessionStatus.Connected)
{
   /* 
   Also use loginResult.Session as the Session which you will require to use live services by creating LiveConnectClient instance as follows.
   */

   // LiveConnectClient liveClient = new LiveConnectClient(loginResult.Session);

   // Write the logic you want by using liveClient instance
}
Run Code Online (Sandbox Code Playgroud)

我尝试过这个片段,它对我有用。干杯