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
0
votes
4 answers

WPF MultiThreading: How can this still cause an exception? (Careful with that Dispatcher!)

I have the following code in a message handler (that can be invoked on any thread): private readonly Dictionary _openedViews = new Dictionary(); private readonly object _lockObject = new object(); public MainView() { …
TDaver
  • 7,164
  • 5
  • 47
  • 94
0
votes
1 answer

Delete specific columns based on their header

I've created the following macros in Calc which loops through a specified row, searches for the pre-defined headers and then deletes their entire column (including the header), the code works, relevant columns do get deleted, however I've…
0
votes
1 answer

Dispatch.BeginInvoke What am i doing wrong?

I have a ViewModel which contains a QueryData method: void QueryData() { _dataService.GetData((item, error) => { if(error != null) return; Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => { …
TheJoeIaut
  • 1,522
  • 2
  • 26
  • 59
0
votes
1 answer

Most efficient way of updating "3 minutes ago" type text in WPF

I currently use a valueconverters in XAML to display my viewmodel DateTime fields in "x minutes ago" format. I need to have them updated periodically without causing too much overhead. At any one time I have a dozen on screen, and a few dozen off…
Jamona Mican
  • 1,574
  • 1
  • 23
  • 54
0
votes
3 answers

How to prevent circular reference in MVVM when using DispatcherObject.Dispatcher

The below code is very simplified. I'm trying to abstract a dispatcher context so my view models can synchronize events that can only be raised on the GUI thread. There's a circular reference in this pattern. Is there any other way to create a…
qxn
  • 17,162
  • 3
  • 49
  • 72
0
votes
3 answers

open another xaml window with STA thread error

I am working with WPF. I run a thread process in the main xaml window using Dispatcher. Then I got this error for opening another WPF to show the result of displaying a 3D image: {"The calling thread must be STA, because many UI components require …
olidev
  • 20,058
  • 51
  • 133
  • 197
0
votes
3 answers

C# Updating TextBox From Another Class

All I am trying to do is update a textBox (in this case txtInit) from another class. I have been reading a lot about how a UI Thread has to change itself, and something about using a dispatcher. I found an answer on here that seemed close, but I…
Ramrod
  • 378
  • 7
  • 18
0
votes
1 answer

WPF Application freezes on moving

I just did a simple application to get a screenshot periodically. The main issue I have got is that application freezes when I move it. So the main goal is to take out this influence of the screenshot, threads and etc. I put here all code and it…
NoWar
  • 36,338
  • 80
  • 323
  • 498
0
votes
2 answers

RequestDispatcher .forward(req, res) in Servlet doesn't have any effect

I have a problem with forwarding to a .jsp page. Let me describe my program: In Servlet I would like to confirm something so I did .forward() to .jsp where I have included javascript with confirm in $(document).ready(function()... In case OK was…
petter386
  • 205
  • 1
  • 5
  • 19
0
votes
1 answer

App doesn't exit

Why app is still working, when i close it. I guess it is caused by reading of data from serial port. Serial Port number is choosed from ComboBox. Function WriteData update checkboxes depending on data from serial port. Here's extract: //…
hradecek
  • 2,455
  • 2
  • 21
  • 30
0
votes
2 answers

Convert a WPF dispatcher to Winforms BGworker?

i recently acquired some source code for a console wrapper for a server. The program was originaly in WPF and part of the code was: private void ServerProc_ErrorDataReceived(object sender, DataReceivedEventArgs e) { Dispatcher.Invoke(new…
0
votes
2 answers

How to make a WPF control that updates every second?

This question is similar to another one I asked, but whereas in that case I wanted to know about forcing a binding to update from XAML or a view model, in this case I'd like to know about wrapping this up into a custom WPF FrameworkElement. The…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
-1
votes
0 answers

Need assistance in Thread Handling

actually I was facing the below exception when I try to update the collection outside the UI thread in my WPF app. But found the dispatcher solution to fix the exception. But my collections are actually dependent on each other. When I updates one…
Vignesh G
  • 53
  • 6
-1
votes
1 answer

When is a dispatcher needed in WPF

The suggested duplicate thread did not address my question So it is my understanding that a WPF application handles everything UI related, button presses, updates to observable collections through the dispatcher thread, which can be called with…
Moon
  • 85
  • 1
  • 5
-1
votes
1 answer

Are WPF DataBindings not refreshed on Dispatcher.Yied()?

So, I have this big application that does some long work on the UI Thread. I know it's bad design, but this can't be changed. Thake it as a constraint. To show the progress of the work, I want to show a WPF dialog with a progressbar. The dialog is…
SWSBB
  • 61
  • 5