<pre name="code" class="csharp"> Public void DoEvents()
{
var frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
new DispatcherOperationCallback(ExitFrames), frame);
try
{
Dispatcher.PushFrame(frame);
}
catch (InvalidOperationException)
{
}
}
private object ExitFrames(object frame)
{
((DispatcherFrame)frame).Continue = false;
return null;
}
引用地址:http://blog.csdn.net/CLeopard/article/details/39997423