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
6
votes
3 answers

WPF Dispatcher, Background worker and a whole lot of pain

Ok this may be really simple but everything I try just seems to hit a brick wall. I have a view model with two properties, which are bound to my WPF form: bool IsWorking {get;set;} ObservableCollection PendingItems {get;set;} I…
Nathan W
  • 54,475
  • 27
  • 99
  • 146
6
votes
2 answers

C#, WPF, Automatically call Dispatcher.Invoke when needed?

I have a program with a Geospace map embedded into it. The event handling for the map is handled on a separate thread to keep the map responsive (for example, the events that fire when the map is clicked). The problem I am having is when the map…
user113164
  • 1,437
  • 5
  • 17
  • 17
6
votes
1 answer

What Dispatcher should I use for UI operations in a Visual Studio 2010+ extension

Currently I'm aware of the following Dispatcher objects. If you have a text view, you can use IWpfTextView.VisualElement.Dispatcher. If your class is constructed by MEF (marked with [Export] and not directly constructed from your own code), then…
Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
6
votes
2 answers

ManualResetEvent WaitOne blocks the owner Thread of my CollectionView

I've written a WPF WizardFramework which performs some actions in the background using some BackgroundWorker. While processing it can happen that I have to update an ObservableCollection which is bound to my UI. For this case I've written a…
Herm
  • 2,956
  • 19
  • 32
6
votes
1 answer

WPF Dispatcher - Suddenly "stuck" and not processing actions until I press a key

We're experiencing a very weird issue in our WPF app. On startup our app fires off some service requests. Then when the window is loaded is unresponsive until we press a key. CPU usage is 0%. It looks like a UI deadlock although not a true one - we…
Alberto
  • 333
  • 2
  • 16
6
votes
1 answer

C# mixed use of Task and Dispatcher.Invoke, why it halts?

I tried below snippet: public Task RunUiTask(Action action) { var task = Task.Factory.StartNew(() => { Dispatcher.Invoke(DispatcherPriority.Background, action); }); return task; } private…
David
  • 15,894
  • 22
  • 55
  • 66
6
votes
1 answer

F# dispatcher.invoke and delegate method

I looked for a solution to this problem for a long time without success. I am porting some of my C# code to F# and I am struggling with a Dispatcher.Invoke for a WPF element. Since I am a total noob in F#, the only thing that I am sure of is that…
Anass
  • 73
  • 4
6
votes
1 answer

What is the trick to creating a responsive WPF UI when populating multiple ListBoxes?

I am working on a support tool that displays multiple TabItems in a TabControl. Each TabItem represents an employee, and within each of these employee Tabs there is another TabControl which contains additional TabItems. These TabItems represent…
Jake Shakesworth
  • 3,335
  • 4
  • 29
  • 43
6
votes
3 answers

WPF Dispatcher Invoke return value is always null

I have a call to a method that returns a UIElement that I call using the Dispatcher, below is the code. However the return value of the Dispatcher invoke is always NULL, any ideas? void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { …
Mrroper
6
votes
3 answers

"The calling thread must be STA" workaround

I know there are a few answers on this topic on SO, but I can not get any of the solutions working for me. I am trying to open a new window, from an ICommand fired from within a datatemplate. Both of the following give the aforementioned error when…
Jamona Mican
  • 1,574
  • 1
  • 23
  • 54
5
votes
1 answer

OOo: UNO (Java) TrackedChanges: How to accept (or hide) Tracked Changes when Document is hidden?

My Problem: I write an automated system that needs to read .doc and .odt, performs some operation on it and exports it to pdf again. Currently that works fine for everything I need, I could solve all problems until this one: If a user provides a…
Angelo Fuchs
  • 9,825
  • 1
  • 35
  • 72
5
votes
2 answers

Spring 3.0 junit test DispatcherServlet

I am trying to test my application with junit. Therefore I've setup the following class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "/META-INF/spring/applicationContext-test.xml"…
Alexander
  • 7,178
  • 8
  • 45
  • 75
5
votes
0 answers

Testing simple Loading+fetch flow with Coroutines as Android Instrumented tests with StandardTestDispatcher

I want to test the following very common usecase as an Instrumented Test in Android: When clicking a button a fetch() function is called in my ViewModel This function tells the view to show a loading-overlay It executes a fetch in a coroutine After…
kapukinz
  • 165
  • 14
5
votes
3 answers

Is it possible to create method call dispatcher in C++?

Consider a following code: struct X { void MethodX() { ... } }; struct Y { void MethodY() { ... } }; void test () { X x; Y y; Dispatcher d; d.Register("x", x, &X::MethodX); d.Register("y", y, &Y::MethodY); d.Call("x"); …
Łukasz Lew
  • 48,526
  • 41
  • 139
  • 208
5
votes
3 answers

cherrypy handle all request with one function or class

i'd like to use cherrypy but i don't want to use the normal dispatcher, i'd like to have a function that catch all the requests and then perform my code. I think that i have to implement my own dispatcher but i can't find any valid example. Can you…
wezzy
  • 5,897
  • 3
  • 31
  • 42