Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WPF再描画のためのDoEventsメソッド
using System.Windows.Threading;
/// <summary>
/// 現在メッセージ待ち行列の中にある全てのUIメッセージを処理します。
/// </summary>
private void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
var callback = new DispatcherOperationCallback(obj =>
{
((DispatcherFrame)obj).Continue = false;
return null;
});
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, callback, frame);
Dispatcher.PushFrame(frame);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment