LiveConnectClient 缺少事件处理程序 Live SDK 5.3 WP8 [英] LiveConnectClient missing eventhandlers Live SDK 5.3 WP8
问题描述
你好:) 我马上就来.
hi there :) il get right to it.
问题:当我尝试实例化 LiveConnectClient 然后尝试访问该事件时:GetCompleted假设在 LiveConnectClient 中的未显示,并且在我查看的所有示例中,甚至此处的示例都在使用它.这不是唯一一个发生这种情况的类,它也发生在 LiveAuthClient 上,甚至网络上的帖子也没有发生任何事件.
Problem : when i try to instanciate LiveConnectClient and then try to access the event : GetCompleted which supose to be in the LiveConnectClient is not showing and on all the examples i been looking at even those on here are using it. this is not the only class this is happening on it is also happening on LiveAuthClient as well no events even the post on the net says there should be.
我尝试从头开始重新安装 Vs2012 和 sdk wp8 和 live sdk,但没有解决
i tried to reinstall Vs2012 and sdk wp8 and live sdk from scratch but have not solved it
作为参考,我使用这个例子来看看我是否可以工作:
for refrence i using this example to see if i can it to work :
//event triggered when Skydrive sign in status is changed
private void btnSignIn_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
{
//if the user is signed in
if (e.Status == LiveConnectSessionStatus.Connected)
{
session = e.Session;
client = new LiveConnectClient(e.Session);
infoTextBlock.Text = "Accessing SkyDrive...";
//get the folders in their skydrive
client.GetCompleted +=
new EventHandler<LiveOperationCompletedEventArgs>(btnSignin_GetCompleted);
client.GetAsync("me/skydrive/files?filter=folders,albums");
}
//otherwise the user isn't signed in
else
{
infoTextBlock.Text = "Not signed in.";
client = null;
}
}
我没有运气解决它并且没有想法.所以我希望你们中的一个男孩可以对它有所了解,或者用露珠的话伸出援手:)
i got no luck solving it and running out of ideas. So im hoping one of u boys out there can shed some light on it or lend a hand with dew wise words :)
提前致谢.如果这篇文章太长,我深表歉意.
thanks in advance. and i do apologies if this is to long a post.
问候詹斯
推荐答案
确实,这些事件似乎已在最新版本的 SDK 中删除.不过,由于 async/await 关键字,您不需要它们.首先,将您的方法标记为 async
,然后使用 await
关键字调用 GetAsync
方法.然后将您通常放入 GetCompleted
事件中的代码放在后面:
Indeed, it seems like those events have been removed in the latest versions of the SDK. You don't need them though, thanks to the async/await keywords. First, mark your method as async
, then call the GetAsync
method with the await
keyword. And place afterward the code you would normally put in the GetCompleted
event:
private async void btnSignIn_SessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
{
//if the user is signed in
if (e.Status == LiveConnectSessionStatus.Connected)
{
session = e.Session;
client = new LiveConnectClient(e.Session);
infoTextBlock.Text = "Accessing SkyDrive...";
//get the folders in their skydrive
var result = await client.GetAsync("me/skydrive/files?filter=folders,albums");
// Do here what you would normally do in btnSignin_GetCompleted
}
//otherwise the user isn't signed in
else
{
infoTextBlock.Text = "Not signed in.";
client = null;
}
}
这篇关于LiveConnectClient 缺少事件处理程序 Live SDK 5.3 WP8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!