This is a mirror of official site: http://jasper-net.blogspot.com/

WPF - DoEvents like Windows Forms

| Wednesday, November 17, 2010
בגלל ארכיטקטורה שונה אין ב WPF את הפונקציה DOEVENT

להלן הקוד ל WPF:

public static void DoEvents()
{

// Create new nested message pump.
DispatcherFrame nestedFrame = new DispatcherFrame();

// Dispatch a callback to the current message queue, when getting called,
// this callback will end the nested message loop.
// note that the priority of this callback should be lower than the that of UI event messages.
DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, exitFrameCallback, nestedFrame);

// pump the nested message loop, the nested message loop will immediately
// process the messages left inside the message queue.
Dispatcher.PushFrame(nestedFrame);

// If the "exitFrame" callback doesn't get finished, Abort it.
if (exitOperation.Status != DispatcherOperationStatus.Completed)
{

exitOperation.Abort();
}
}

Read more: Uzi Drori's Blog

Posted via email from .NET Info

0 comments: