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
4
votes
1 answer

Difference between ExecutorCoroutineDispatcher and CoroutineDispatcher

Can someone please explain the difference between Kotlin Coroutine's ExecutorCoroutineDispatcher and CoroutineDispatcher from practical point of view, i.e. in which scenarios to use one against another? So far I've been using Dispatchers, but (as…
Myroslav
  • 896
  • 12
  • 21
4
votes
1 answer

Problem with WPF Application and slow GUI response

I've been analyzing a WPF application which basically fetch data from a server and display the data in the GUI. This code is not mine, and the application has a problem related with slow response from the GUI, I'm trying to find the reason for that…
Vic
  • 2,878
  • 4
  • 36
  • 55
4
votes
3 answers

Using Dispatcher in unit-testable MVVM code

I've an MVVM-lite application that I'd like to have unit testable. The model uses a System.Timers.Timer and so the update event ends up on a background worker thread. This unit-tested fine, but at runtime threw the System.NotSupportedException "This…
dumbledad
  • 16,305
  • 23
  • 120
  • 273
4
votes
0 answers

Open WPF dialog in new STA thread

I need to show a dialog box that is created with WPF from an MTA thread. I create a new thread, set it to be STA, and display the dialog there. But I cannot figure out from documentation if I actually need to call Dispatcher.Run() and then later…
dbiel
  • 132
  • 5
4
votes
1 answer

Silex 2 addListener trigger error

I'm trying to add an event listener/dispatcher to one of my controller action. It's goal is to add default data to my entity before persisting it in my database. Here is what I've got so far. app.php $app['dispatcher']->addListener('my_event_name',…
Tim
  • 1,238
  • 1
  • 14
  • 24
4
votes
1 answer

F# Winforms Dispatcher BeginInvoke Delegate issue at runtime

I have tried to create an F# implementation of some C# code that uses Dispatcher.BeginInvoke to manipulate the UI from a different thread. However I'm struggling to get the code to work. I've tried a few different implementations but I always seem…
MattP
  • 71
  • 3
4
votes
1 answer

How to run a window into a new task and keep its main thread running

Working on a WPF / MVVM app. What is the best way to display a MVC window from my main thread into a new task and let my main thread keep running its next instructions without waiting for the window to close? I would like to run the following: …
A.D.
  • 1,062
  • 1
  • 13
  • 37
4
votes
1 answer

Using VerifyAccess and CheckAccess methods of DispatcherObject

While going through this article I came across this statement - If you are writing your own WPF objects, such as controls, all methods you use should call VerifyAccess before they perform any work. This guarantees that your objects are…
akjoshi
  • 15,374
  • 13
  • 103
  • 121
4
votes
1 answer

Update BindingList<> from a background Thread?

I was wondering how I would use the Dispatcher in WPF to safely update my BindingList collection from another thread? I am also open for other solutions, Many Thanks, Kave
Houman
  • 64,245
  • 87
  • 278
  • 460
4
votes
1 answer

Can I make a WinForms OpenFileDialog.ShowDialog not yield the main thread?

I have a WinForms program which downloads then converts a collection of files each on their own thread via a batch thread used to report overall progress and job completion. Each file will be downloaded on its own thread, then once downloaded, it…
Sphynx
  • 135
  • 2
  • 12
4
votes
1 answer

Why did dispatcher BeginInvoke fail where Control BeginInvoke succeed in C# Windows Forms app?

I originally tried to use the Dispatcher class BeginInvoke method to show a message box on the main UI thread in my C# Windows Forms app. When I used that method the message box did not appear. I set a breakpoint inside the body of the delegate I…
Robert Oschler
  • 14,153
  • 18
  • 94
  • 227
4
votes
3 answers

Dispatcher.Invoke blocks forever

I'm trying to invoke a dialog on the UI dispatcher : class DialogService : IDialogService { private readonly Dispatcher _dispatcher = Application.Current.Dispatcher; public bool? Show(IDialogViewModel viewModel) { if…
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
4
votes
1 answer

How WPF Multi threading works?

I knew the basic building blocks of multithreading in WPF, but I do have a question which is quite confusing me. WPF applications start with two threads: one for handling rendering and another for managing the UI. This sounds good,but the UI…
Selva
  • 1,310
  • 2
  • 14
  • 31
4
votes
4 answers

Creating a System.Windows.Controls.Image throws an exception - how do I use the dispatcher to instantiate it?

I'm running my unit tests on a piece of code that does the following in the test: Assert.IsNotNull(target.Icon); Inside the getter for the Icon property, I'm doing this: System.Windows.Controls.Image img = new…
Scott Whitlock
  • 13,739
  • 7
  • 65
  • 114
4
votes
1 answer

What is the dispatcher priority given to the action when you call Dispatcher.Invoke(Action)?

What is the dispatcher priority given to the action when you call Dispatcher.Invoke(Action)? I understand how Dispatcher.Invoke(Action, DispatcherPriority) works, I assume that if you leave out the DispatcherPriority parameter it will give the…
whilej10
  • 73
  • 5