Skip to content

Instantly share code, notes, and snippets.

@pinzolo
Created May 27, 2012 12:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pinzolo/2814091 to your computer and use it in GitHub Desktop.
Save pinzolo/2814091 to your computer and use it in GitHub Desktop.
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