문제

I'm developing a WP7.1 app on VS2012.

I'd like to use Live SDK for uploading a file to Skydrive. However, when I'm implementing the event handler method which is given as a sample on msdn.com I got the error "Cannot await 'void' " here:

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");

I already installed this (http://blogs.msdn.com/b/bclteam/archive/2012/10/22/using-async-await-without-net-framework-4-5.aspx?PageIndex=2) library, but it only resolved the problem with the "async" keyword.

도움이 되었습니까?

해결책

LiveConnectClient is probably using the Event-based Asynchronous Pattern, which is not directly convertible to an awaitable method. You can wrap EAP into a Task by using TaskCompletionSource as described on MSDN here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top