0
乾草在那裏我正在學習Windows SDK的Live SDK 8 &我使用Live SDK 5.5 我已經下載了SDK,安裝了它並在我的項目中引用了它 我也創建了我的應用程序和我一個鍵,然後在here 確切的代碼,這就是我的代碼 XAML 用於Windows Phone 8的Live SDK
<live:SignInButton ClientId="my ID" x:Name="btnSignin" Scopes="wl.signin wl.basic" Branding="Skydrive" SessionChanged="btnSignin_SessionChanged" Margin="10,0,-10,194" Height="104" VerticalAlignment="Bottom" />
<TextBlock Height="102" Foreground="White" HorizontalAlignment="Left" Margin="26,128,0,0" Name="infoTextBlock" VerticalAlignment="Top" Width="419" />
</Grid>
,這就是我的C#代碼
private async void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e)
{
if (e.Status == LiveConnectSessionStatus.Connected)
{
client = new LiveConnectClient(e.Session);
LiveOperationResult operationResult = await client.GetAsync("me");
try
{
dynamic meResult = operationResult.Result;
if (meResult.first_name != null &&
meResult.last_name != null)
{
infoTextBlock.Text = "Hello " +
meResult.first_name + " " +
meResult.last_name + "!";
}
else
{
infoTextBlock.Text = "Hello, signed-in user!";
}
}
catch (LiveConnectException exception)
{
this.infoTextBlock.Text = "Error calling API: " +
exception.Message;
}
}
else
{
infoTextBlock.Text = "Not signed in.";
}
}
但應用程序不會顯示我的登錄頁面,以便我輸入我的用戶名和密碼爲我的真實帳戶它只是加載,然後它在文本框中顯示「未登錄」
您是否嘗試將wl.skydrive添加到作用域:'Scopes =「wl.signin wl.skydrive wl.basic」'?還要檢查您是否將手機標記爲您的應用程序(在那裏您已經註冊並獲得了ID)。 – Romasz
感謝他的工作:) – a3adel