Questions tagged [dispatcher]

In WPF and Silverlight, Dispatcher is an object that is used to execute work on a specific thread. In another meaning, dispatcher defines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server.

In and , Dispatcher is an object that is used to execute work on a specific .

In another meaning, a dispatcher object can forward a client's request to a resource or include the resource itself in the response back to the client. A resource can be another servlet, or an HTML file, or a JSP file, etc.

1296 questions
22
votes
6 answers

The calling thread cannot access this object because a different thread owns it.WPF

Whenever I refresh a label, I got this error: The calling thread cannot access this object because a different thread owns it. I tried to invoke but it's failed. I'm using WPF Form. delegate void lostfocs(string st); private void…
Yasser
  • 1,725
  • 4
  • 22
  • 28
21
votes
4 answers

Must create DependencySource on same Thread as the DependencyObject

I bind observable dictionary from view model to view. I use Caliburn Micro Framework. View:
user572844
20
votes
6 answers

How can I get a TaskScheduler for a Dispatcher?

I've got an application with multiple Dispatchers (aka GUI threads, aka message pumps) to ensure that a slow, unresponsive portion of the GUI runs without affecting the rest of the application too heavily. I also use Task a lot. Currently I've got…
Eamon Nerbonne
  • 47,023
  • 20
  • 101
  • 166
20
votes
1 answer

Understanding the Dispatcher Queue

I think I need some help understanding the Dispatcher Queue. When new work arrives it gets added at the beginning of the dispatcher queue and when the Dispatcher wants to process a working item it gets removed from the beginning. In more general…
marc wellman
  • 5,808
  • 5
  • 32
  • 59
19
votes
9 answers

Job queue with job affinity

I am currently facing a problem for which I am pretty sure there is an official name, but I don't know what to search the web for. I hope that if I describe the problem and the solution I have in mind, somebody is able to tell me the name of the…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
19
votes
3 answers

Is WPF Dispatcher the solution of multi threading problems?

I have a very bad feeling about using lock in my code but now the Dispatcher of WindowBase exists and I want to use it everywhere. For example I use a multi thread singleton WCF service who publish events on the EventAggregator of PRISM, the payload…
Nicolas Dorier
  • 7,383
  • 11
  • 58
  • 71
19
votes
4 answers

Delayed Dispatch Invoke?

In WPF due to the intricacies on how the interface is updated I sometimes have to perform actions after a short delay. Currently I'm doing this simply by: var dt = new DispatcherTimer(DispatcherPriority.Send); dt.Tick += (s, e) => …
Homde
  • 4,246
  • 4
  • 34
  • 50
18
votes
3 answers

Getting UI dispatcher in class library

I'd like to design a class library and plan to use mutli-threading (i.e. BackgroundWorker). I will have to watch out for the thread context, from which updates are made for fields, if I plan to bind them to the GUI of the library consuming frontend.…
rdoubleui
  • 3,554
  • 4
  • 30
  • 51
18
votes
5 answers

WPF Dispatcher.BeginInvoke and UI/Background Threads

I think I need some clarifications regarding WPFs Dispatcher.Invoke and Dispatcher.BeginInvoke usage. Suppose I have some long running 'work' code like such that is invoked on the press of a button in a simple WPF application: longWorkTextBox.Text =…
Matthew Ruston
  • 4,282
  • 7
  • 38
  • 47
17
votes
1 answer

WPF Application is deadlocked when invoking on the Dispatcher

We are occasionally having a situation where the application is deadlocked and it seems that the dispatcher is deadlocked with a background thread trying to invoke on the dispatcher. I don't see that either thread has any shared resources that are…
Ben
  • 597
  • 1
  • 6
  • 19
17
votes
5 answers

WPF Dispatcher {"The calling thread cannot access this object because a different thread owns it."}

first I need to say that I´m noob with WPF and C#. Application: Create Mandelbrot Image (GUI) My dispatcher works perfectly this this case: private void progressBarRefresh(){ while ((con.Progress) < 99) { …
Orri
  • 920
  • 1
  • 8
  • 20
17
votes
2 answers

What is the difference between Dispatcher thread and UI thread

Is UI thread and Dispatcher thread are same in WPF or is there any difference?
Mohd Ahmed
  • 1,422
  • 13
  • 27
14
votes
3 answers

.NET Create New Dispatcher

I am trying to create a second thread with dispatcher so that I can have the primary dispatcher (for the UI) completely stress-free, and have the UI constantly respondant. Now, I could create multiple threads for each sub (or void in C#), but isn't…
René Sackers
  • 2,395
  • 4
  • 24
  • 43
14
votes
2 answers

"The calling thread must be STA, because many UI components require this" error when creating a WPF pop-up Window in thread

I have a WPF application in which a thread checks some value. In certain cases, I show a pop-up Window in order to display a message. When I create this pop-up window in the thread, an exception is thrown by the pop-up window's constructor: "The…
Rev
  • 2,269
  • 8
  • 45
  • 75
14
votes
2 answers

How can I detect if Dispatcher.DisableProcessing is active?

An exception is raised if one tries to show a message box if the Dispatcher is suspended (Dispatcher.DisableProcessing() called). InvalidOperationException: 'Dispatcher processing has been suspended' (see here). Does anyone know how I can detect…
Muri
  • 141
  • 1
  • 4
1 2
3
86 87