當前位置: 首頁>>代碼示例>>C#>>正文


C# ParseUser.LinkWithAsync方法代碼示例

本文整理匯總了C#中Parse.ParseUser.LinkWithAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# ParseUser.LinkWithAsync方法的具體用法?C# ParseUser.LinkWithAsync怎麽用?C# ParseUser.LinkWithAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parse.ParseUser的用法示例。


在下文中一共展示了ParseUser.LinkWithAsync方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LinkAsync

 /// <summary>
 /// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
 /// for authentication, and providing access to Facebook data for the user.
 /// 
 /// The user will be logged in through Facebook's OAuth web flow, so you must supply a
 /// <paramref name="webView"/> that will be navigated to Facebook's authentication pages.
 /// </summary>
 /// <param name="user">The user to link with Facebook.</param>
 /// <param name="webView">A web view that will be used to present the authorization pages
 /// to the user.</param>
 /// <param name="permissions">A list of Facebook permissions to request.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 public static async Task LinkAsync(ParseUser user,
     WebBrowser webView,
     IEnumerable<string> permissions,
     CancellationToken cancellationToken) {
   authProvider.Permissions = permissions;
   LoadCompletedEventHandler loadCompleted = (_, e) => authProvider.HandleNavigation(e.Uri);
   webView.LoadCompleted += loadCompleted;
   Action<Uri> navigate = uri => webView.Navigate(uri);
   authProvider.Navigate += navigate;
   await user.LinkWithAsync("facebook", cancellationToken);
   authProvider.Navigate -= navigate;
   webView.LoadCompleted -= loadCompleted;
 }
開發者ID:cnbcyln,項目名稱:Parse-SDK-dotNET,代碼行數:25,代碼來源:ParseFacebookUtils.NetFx45.cs

示例2: LinkAsync

 /// <summary>
 /// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
 /// for authentication, and providing access to Facebook data for the user.
 /// 
 /// The user will be logged in through Facebook's OAuth web flow using the Windows
 /// WebAuthenticationBroker.
 /// </summary>
 /// <param name="user">The user to link with Facebook.</param>
 /// <param name="permissions">A list of Facebook permissions to request.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 public static async Task LinkAsync(ParseUser user,
     IEnumerable<string> permissions,
     CancellationToken cancellationToken) {
   var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
   authProvider.Permissions = permissions;
   Action<Uri> navigate = async uri => {
     var result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None,
         uri,
         FacebookAuthenticationProvider.ResponseUrl);
     if (result.ResponseStatus != WebAuthenticationStatus.Success) {
       cts.Cancel();
     } else {
       authProvider.HandleNavigation(new Uri(result.ResponseData));
     }
   };
   authProvider.Navigate += navigate;
   try {
     await user.LinkWithAsync("facebook", cts.Token);
   } finally {
     authProvider.Navigate -= navigate;
   }
 }
開發者ID:mehul9595,項目名稱:Parse-SDK-dotNET,代碼行數:32,代碼來源:ParseFacebookUtils.WinRT.cs

示例3: LinkAsync

 /// <summary>
 /// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
 /// for authentication, and providing access to Facebook data for the user.
 /// </summary>
 /// <param name="user">The user to link to a Facebook account.</param>
 /// <param name="facebookId">The user's Facebook ID.</param>
 /// <param name="accessToken">A valid access token for the user.</param>
 /// <param name="expiration">The expiration date of the access token.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 public static Task LinkAsync(ParseUser user,
     string facebookId,
     string accessToken,
     DateTime expiration,
     CancellationToken cancellationToken) {
   return user.LinkWithAsync("facebook",
       authProvider.GetAuthData(facebookId, accessToken, expiration),
       cancellationToken);
 }
開發者ID:mehul9595,項目名稱:Parse-SDK-dotNET,代碼行數:18,代碼來源:ParseFacebookUtils.cs


注:本文中的Parse.ParseUser.LinkWithAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。