private void RefreshToken(Action <LiveLoginResult> completionCallback)
 {
     if (this.refreshTokenInfo != null)
     {
         LiveAuthRequestUtility.RefreshTokenAsync(
             this.clientId,
             null,
             LiveAuthUtility.BuildDesktopRedirectUrl(),
             this.refreshTokenInfo.RefreshToken,
             null     /*scopes*/
             ).ContinueWith(t =>
         {
             if (t.Exception != null)
             {
                 throw t.Exception;
             }
             this.OnRefreshTokenCompleted(t.Result, completionCallback);
         });
     }
     else
     {
         LiveLoginResult result = new LiveLoginResult(LiveConnectSessionStatus.Unknown, null);
         this.OnRefreshTokenCompleted(result, completionCallback);
     }
 }
        private void ExchangeCodeForToken(string authorizationCode)
        {
            Task <LiveLoginResult> task = LiveAuthRequestUtility.ExchangeCodeForTokenAsync(
                this.clientId,
                null,
                LiveAuthUtility.BuildDesktopRedirectUrl(),
                authorizationCode);

            task.ContinueWith((Task <LiveLoginResult> t) =>
            {
                this.OnExchangeCodeCompleted(t.Result);
            });
        }