2012-01-02 28 views
1

每當我嘗試創建任何Twitter請求時,我的應用程序總是掛起。這雖然不適用於oAuthUtility,但我已成功授權用戶使用我的應用程序,但每當我提出請求時,它都會掛起。這是我提出的請求中的一個掛起:TwitterResponse導致在Silverlight上掛起

 Dim response As TwitterResponse(Of TwitterStatus) = TwitterStatus.Update(myFire_tokens.Tokens, TextBox1.Text) 
    If response.Result <> RequestResult.Success Then 
     MessageBox.Show(response.ErrorMessage, "Error", MessageBoxButton.OK) 
    Else 
     MessageBox.Show("Tweet Sent", "Awesome!", MessageBoxButton.OK) 
    End If 

這掛在版本2.4和版本出現:504,516,523和Silverlight的5和4。我相信問題在於TwitterResponse因爲該方法確實被調用(例如,如果我運行上面的代碼,推文會發布),因爲我可以在Fiddler中看到OK響應。

調試器中沒有引發異常,應用程序只是掛起。

回答

1

您應該鏈接到SilverlightAsync項目。

如果您對Silverlight的一面,它會使用這個簽名:

public static IAsyncResult Update(
    OAuthTokens tokens, 
    string text, 
    StatusUpdateOptions options, 
    TimeSpan timeout, 
    Action<TwitterAsyncResponse<TwitterStatus>> function) 

通知額外的兩個參數?

您的代碼應該是這個樣子

TwitterStatus.Update(
    myFire_tokens.Tokens, 
    TextBox1.Text, 
    Nothing, 
    0, 
    Sub (response As TwitterAsyncResponse<TwitterStatus>) 
     If response.Result <> RequestResult.Success Then 
      MessageBox.Show(response.ErrorMessage, "Error", MessageBoxButton.OK) 
     Else 
      MessageBox.Show("Tweet Sent", "Awesome!", MessageBoxButton.OK) 
     End If 
    End Sub) 
+0

謝謝!有效! – 2012-01-05 00:01:21