0

在按钮单击事件(表单控件)中,我有:

Action<SomeType, CallbackType> action = (__o1, __callback) =>
{
  __o1.Operation(__callback);
};
action.BeginInvoke(
  o1, 
  callback,
  (asyncCallback) => 
    ((Action<SomeType, CallbackType>)asyncCallback.AsyncState).EndInvoke(asyncCallback),
  action);

由于某些未知原因,UI 线程挂起,直到此异步调用返回。但仍然单击事件实现返回。

任何想法可能是什么问题?

4

1 回答 1

0

尝试这个:

Action<SomeType, CallbackType> action = (__o1, __callback) =>
{
    __o1.Operation(__callback);
};
action.BeginInvoke(
    o1,
    callback,
    (asyncCallback) =>
    ((Action<SomeType, CallbackType>)((AsyncResult)asyncCallback).AsyncDelegate).EndInvoke(asyncCallback),
    action);
于 2012-11-23T09:11:01.110 回答