什么是 DispatcherFrame 以及如何使用它?

Wil*_*iam 7 c# wpf dispatcher

这是MSDN提供的代码,虽然它似乎不清楚它在做什么:

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public void DoEvents()
{
    DispatcherFrame frame = new DispatcherFrame();
    Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
    new DispatcherOperationCallback(ExitFrame), frame);
    Dispatcher.PushFrame(frame);
}

public object ExitFrame(object f)
{
    ((DispatcherFrame)f).Continue = false;

    return null;
}
Run Code Online (Sandbox Code Playgroud)

我刚刚注意到今天在DoEvents定义该方法的一些遗留代码中的类似实现。为什么我们需要这个以及将框架推送到调度程序上意味着什么?