public partial class App : Application { #region DoEvent private static DispatcherOperationCallback exitFrameCallback = new DispatcherOperationCallback(ExitFrame); private static Object ExitFrame(Object state) { DispatcherFrame frame = state as DispatcherFrame; // Exit the nested message loop. if (frame != null) { frame.Continue = false; } return null; } public static void DoEvents() { DispatcherFrame nestedFrame = new DispatcherFrame(); DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, exitFrameCallback, nestedFrame); Dispatcher.PushFrame(nestedFrame); if (exitOperation.Status != DispatcherOperationStatus.Completed) { exitOperation.Abort(); } } #endregion }
在使用的过程中,可以在 Application.Current.Dispatcher.Invoke中调用来更新了
标签:frame,exitOperation,Dispatcher,static,更新,WPF,nestedFrame,DispatcherFrame,实时 From: https://www.cnblogs.com/hurui1/p/18124067