0

使用 Twitterizer 网站上的代码示例,我正在尝试使用以下代码向 twitter 发布推​​文:

        Dim asyncResult As IAsyncResult = TwitterStatusAsync.Update(
        tokens.Tokens,
        Tweet.Text,
        Nothing,
        Timeout,
        Function(updateResponse)
            If (updateResponse.Result = RequestResult.Success) Then
                MessageBox.Show("Tweet Posted")
            Else
                MessageBox.Show("Error: " & updateResponse.ErrorMessage)
            End If
        End Function)

但我得到了这个例外:

System.NotSupportedException 未被用户代码处理 Message=不支持指定的方法。StackTrace:在 System.Func 4.BeginInvoke(T1 arg1, T2 arg2, T3 arg3, AsyncCallback callback, Object object) at Twitterizer.AsyncUtility.ExecuteAsyncMethod[TResponse,TProperties](OAuthTokens tokens, String s, TProperties properties, TimeSpan timeout, Func4 方法调用,操作1 function) at Twitterizer.TwitterStatusAsync.Update(OAuthTokens tokens, String text, StatusUpdateOptions options, TimeSpan timeout, Action1 个函数)在 myFire_Silverlight._twitter.Status_Post(mf_object_tweet Tweet) 在 myFire_Silverlight.TweetDialog.OKButton_Click(Object sender, RoutedEventArgs e) 在 System.Windows.Controls.Primitives.ButtonBase.OnClick() 在 System.Windows.Controls.Button.OnClick () 在 System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) 在 System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e) 在 MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags) InnerException:

我究竟做错了什么?

4

1 回答 1

1

Ricky 回复了我在 Twitterizer.net 上的表单帖子,他的帖子是:


我问了一个在图书馆那部分工作的人(我相信大部分都是这样),这就是他所说的......

hrm,所以它基本上是两个问题...... 1. Silverlight Async 库的那部分不支持发布推文,我只有时间选择性地实现对 Async 库的 SL 支持和 2. 最近对源(Henriks Async Helpers)已从异步库中删除所有 SL 支持,因为 SL 不支持 Func.BeginInvoke。

因此,您可能需要使用非异步方法并将它们放在您自己的异步事件处理程序中。(也就是说,如果我正确理解了这个问题和他的回答。)

于 2012-02-04T22:29:27.853 回答