0
我是LinQ的noob,遇到Linq2Twitter和Twitter API的問題。Windows Phone Linq2Twitter - 獲取授權用戶的屏幕名稱,ID和名稱?
我無法理解如何在成功授權後獲得授權用戶的屏幕名稱,ID和名稱。
我在網上搜索了討論主題,我從喬那裏得到的唯一建議是在查詢結果時使用異步調用。除了我沒有MaterializedAsyncCallback出於某種原因,所以我使用AsyncCallback來代替。
這裏是我把所有的方式,從授權到試圖獲取用戶信息的步驟:
與我的消費密鑰和密碼作爲憑證創建PinAuthorizer
this.pinAuth = new PinAuthorizer { Credentials = new InMemoryCredentials { ConsumerKey = CONSUMER_KEY, ConsumerSecret = CONSUMER_SECRET }, UseCompression = true, GoToTwitterAuthorization = pageLink => Dispatcher.BeginInvoke(() => { WebBrowser.Navigate(new Uri(pageLink + "&force_login=true", UriKind.Absolute)); }) };
授權開始
this.pinAuth.BeginAuthorize(resp => ...
輸入引腳,從而獲得訪問令牌和祕密pinAuth.OAuthTwitter:
pinAuth.CompleteAuthorize( this.pin, completeResp => Dispatcher.BeginInvoke(() => { ...
於是,我試圖讓用戶用...一個異步調用的,這就是喬·梅奧在其他線程建議。
ITwitterAuthorizer auth = pinAuth; TwitterContext twitterCtx = new TwitterContext(pinAuth); (from user in twitterCtx.User where user.UserID != "JoeMayo" select user).AsyncCallback(asyncResponse => { var response = asyncResponse.ToList(); User acc = response.FirstOrDefault(); // Anything in this block is pointless // as I never get into this async callback block. // But this is where I expect to get the user's info // (screen name, name, id, etc.) });
我從來沒有得到過異步響應。 (由於某些原因,我也沒有MaterializedAsyncCallback
)。
如何獲得授權用戶的屏幕名稱,ID和名稱?
答案是你需要的。有關同一問題的更多信息,請訪問:http://linqtotwitter.codeplex.com/discussions/437277 – 2013-03-20 16:15:25