WPF实现DoEvents
- static void DoEvents()
- {
- DispatcherFrame frame = new DispatcherFrame(true);
- Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, (SendOrPostCallback)delegate(object arg)
- {
- DispatcherFrame fr = arg as DispatcherFrame;
- fr.Continue = false;
- }, frame);
- Dispatcher.PushFrame(frame);
- }
调用:
DoEvents();