0

Aloha everybody,

I have few concerns about Dispatcher.

As far I understood that thingy a Dispather is the UI thread therefore when I use Dispatcher.Invoke I let the UI wait till my operation is done.

Now my question is does the UI wait when I use BeginInvoke method which is async?

What is the "Normal" priority of Dispatcher? Does it mean it executes my operation immediately?

When I only call BeginInvoke without DispatcherProprity which default properity will dispatcher assocciate to my operation?

Now lets combine Normal priority with BeginInvoke. Will dispatcher execute then my operation imediately async or what happens exactly there under the hood?

I apologize in case this question is a duplicate.

4

1 回答 1

0

According to MSDN, the Dispatcher

Provides services for managing the queue of work items for a thread.

So calling Invoke on one does not necessarily have any immediate effect... it simply adds your request onto the queue - this does not mean that your request will be performed immediately.

The DispatcherProprity value tells the Framework where to put the request in the queue. Calling Invoke with a high priority will result in your request being placed in the queue at a high level, just after any other requests that have that same priority.

Regarding calls to BeginInvoke, the only real difference is that the

control returns immediately to the calling object after it is called.

As far as I'm aware, everything else including priority is the same.

于 2013-09-16T10:28:28.887 回答