dispatcher

What is the use of a Dispatcher Object in WPF?

What is the use of a Dispatcher Object in WPF? ...

WPF Dispatcher.Invoke 'hanging'

I have a somewhat complex WPF application which seems to be 'hanging' or getting stuck in a Wait call when trying to use the dispatcher to invoke a call on the UI thread. The general process is: Handle the click event on a button Create a new thread (STA) which: creates a new instance of the presenter and UI, then calls the method Dis...

How do I write a dispatcher, if my compiler's support for pointers-to-functions is broken?

I am working on an embedded application where the device is controlled through a command interface. I mocked the command dispatcher in VC and had it working to my satisfaction; but when I then moved the code over to the embedded environment, I found out that the compiler has a broken implementation of pointer-to-func's. Here's how I or...

System.Windows.Threading.Dispatcher and WinForms?

Does a System.Windows.Threading.Dispatcher work on the UI-thread of a WinForms application? If yes, why? It is coming from WindowsBase.dll which seems to be a WPF component. If not, how can I invoke work units back onto the UI-thread? I've found Control.BeginInvoke(), but it seems clumsy to create a control only to reference the origin...

Practical use for Dispatcher.DisableProcessing ?

What is a common real life use for Dispatcher.DisableProcessing in WPF? Can I use it to suspend rendering and layout when I build a complex UI in code? ...

How to stop one of multiple WPF dispatcher?

I have an app with some background threads (actually an in-proc WCF-Service). Each thread runs its own Dispatcher to use some WPF-classes (MediaPlayer-objects to process some audio/video-files; it queues some delegates with BeginInvoke and finally call Dispatcher.Run). When the processing is done, I want to shutdown its dispatcher so tha...

Is WPF Dispatcher the solution of multi threading problems ?

Hi, 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 is immutable (it is just data) and every thread with a dispatcher can retrieve the...

Errors when trying to use HttpWebRequest in Silverlight 2

Im trying to write to a form from an asynchronous call. The examples I seen on line show that this should work but I keep getting an error. First the call that is made though the Disbatcher never calls p. Second i get a System.Security.SecurityException on the call req.EndGetResponse(a); What could be causing the problem? public parti...

WPF: Building a Queue in a Thread with Timers

With reference to the Software Project I am currently working on. I have the below methods that basically move a canvas with a Timer: DispatcherTimer dt = new DispatcherTimer(); //global public void Ahead(int pix) { var movx = 0; var movy = 0; dt.Interval = TimeSpan.FromMilliseconds(5); ...

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"); d.Call("y"); } The question is how to implement Dispatcher. I don't mind X and Y may ...

ActionScript MouseEvent.clone() appears broken?

I have run into a problem attempting to redispatch mouse events in ActionScript 3, which I am admittedly a bit incredulous about. I have narrowed it down to the MouseEvent.clone() method appearing, well, completely broken. The following event handler: private function handleMouseMove( evt : MouseEvent ) : void { trace("mousemov...

How do I dispatch a custom event from an actionscript 3 class and listen for it in the document root?

I built a custom event dispatcher that passes variables. I dispatch the event and then I try to listen for the event in my document root, but I never receive the event. How do I bubble the event up to my document class? addEventListener(CustomVarEvent.pinClicked, pinClickedHandler); function pinClickedHandler(e:CustomVarEvent) { t...

Is it possible to use a "front controller" in Rails?

In Spring MVC a Dispatcher servlet is used as a "front controller" to handle all of the application requests and route them appropriately. Is it possible to use such an approach in Rails or is it required to write a separate controller for each type of action without having a "traffic cop" (front controller) directing the flow? ...

Why are my sockets only able to communicate client-to-server and not server-to-client?

I have written a simple Java dispatcher with a daemon thread to handle the incoming traffic, and using another thread to send out commands. The problem comes when the server receives the first message, then the client/server system gets stuck on where the server trying to send out a response to the client. The sockets on both end just ...

WPF Dispatcher and Running it in background

I tried to wrap the dispatcher in a thread. But the result is not what i expect. How can i solve that problem? public void Start() { ThreadStart ts = inner; Thread wrapper = new Thread(ts); wrapper.Start(); } private void inner() { _Runner.Dispatcher.Invoke(_Runner.Action, DispatcherP...

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 functionality I'm after is a span of text that indicates how long ago something happened. <T...

Event system in Python

What event system for Python do you use? I'm already aware of pydispatcher, but I was wondering what else can be found, or is commonly used? I'm not interested in event managers that are part of large frameworks, I'd rather use a small bare-bones solution that I can easily extend. ...

wpf: update multiple controls via dispatcher

I'm reading data from a serial port using an event listener from the SerialPort class. In my event handler, I need to update many (30-40) controls in my window with xml data coming over the serial port. I know that I must use myControl.Dispatcher.Invoke() to update it since it's on a different thread, but is there a way to update lots ...

Is there a better way to update UI Element with Dispatcher?

Hi guys I'm a newbie with WCF services, and I'm trying to figure out if is there a better way to update a WPF UI element (like a Label control) when I'm calling asynchronously my WCF service. Here's a piece of code: private void button1_Click(object sender, RoutedEventArgs e) { int result; CalculatorServiceCli...

WPF: Passing objects between UI Thread and Background thread

In my Window constructor after InitializeComponents, I need to create an object and bind it to a datagrid. Since the object creation is taking too much time, the windows takes a while to show up. So I decided to move the creation of the object to a background thread and "delegate back" to the UI thread by doing a dispatcher.invoke to per...