我正在尝试从 SkyDrive 下载文件并将异步调用包装在同步类中。然而,当我打电话给 WaitOne 时,一切都被阻止了,EventHandeler 永远不会被调用。
_client = new LiveConnectClient(connection.Session);
_client.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(client_GetCompleted);
_client.GetAsync("me/skydrive/files");
_autoEvent.WaitOne(); //get's stuck here client_GetCompleted never called.
....
void client_GetCompleted(object sender, LiveOperationCompletedEventArgs e)
{
///do stuff
_autoEvent.Set();
}