/// <summary> /// 创建分享对象,若需要,则弹出授权窗口。 /// </summary> /// <returns>微博分享对象。</returns> /// <exception cref="AuthorizeException">用户取消授权获取授权过程中网络异常。</exception> /// <exception cref="HttpException">获取 AccessToken 过程中网络异常。</exception> public static async Task<WeiboClient> CreateAsync() { WeiboClient client = new WeiboClient(); if (LocalAccessToken.Useable == false) { // 未授权或者授权已过期,请求重新授权。 string authorizeCode = await client.GetAuthorizeCodeAsync(); await client.Authorize(authorizeCode); } return client; }
/// <summary> /// 创建分享对象,若需要,则弹出授权窗口。 /// </summary> /// <returns>微博分享对象。</returns> /// <exception cref="AuthorizeException">用户取消授权获取授权过程中网络异常。</exception> /// <exception cref="HttpException">获取 AccessToken 过程中网络异常。</exception> public static async Task <WeiboClient> CreateAsync() { WeiboClient client = new WeiboClient(); if (LocalAccessToken.Useable == false) { // 未授权或者授权已过期,请求重新授权。 string authorizeCode = await client.GetAuthorizeCodeAsync(); await client.Authorize(authorizeCode); } return(client); }