WPF加速UI进程

public static class WindowEx
{
public static void DoEvents(this Window obj)
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
new DispatcherOperationCallback(delegate (object f)
{
((DispatcherFrame)f).Continue = false;

                return null;
            }
                ), frame);
        Dispatcher.PushFrame(frame);
    }
}
posted @ 2021-01-26 13:52  Hey,Coder!  阅读(121)  评论(0编辑  收藏  举报