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

In WPF, how to set a Window Owner of a Window build on another thread (another Dispatcher)

I got the following exception: InvalidOperationException : The calling thread cannot access this object because a different thread owns it. when I try to set the Owner of a window that is build on another thread than the Owner. I know that I can…
Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119
5
votes
1 answer

dispatcher in event will only invoke once C#

I am writing a program that monitors commands sent from the serialport (from an arduino) and sends keystrokes to various other programs. I have placed a dispatcher in my event, but it will only run once... I have stepped through the code and it runs…
Neon_c
  • 51
  • 3
5
votes
1 answer

How can I delay loading a control until after a RadioButton selection finishes changing?

I have a ListBox that is styled to use RadioButtons, and changing the SelectedItem also changes the UserControl displayed in a ContentControl below it. The application looks like this:
Rachel
  • 130,264
  • 66
  • 304
  • 490
5
votes
6 answers

How to access separate thread generated WPF UI elements from the Dispatcher thread?

I need to generate a print preview (a long one) using wpf UI elements like FixedDocument, FlowDocument, PageContent, BlockUIContainer and all those. To keep my UI responsive i'm doing this part on a separate Thread class thread (BackgroundWorker…
atiyar
  • 7,762
  • 6
  • 34
  • 75
5
votes
2 answers

Execution order of asynchronously invoked methods

When I am invoking a number of methods to a Dispatcher, say the Dispatcher of the UI Thread, like here uiDispatcher.BeginInvoke(new Action(insert_), DispatcherPriority.Normal); uiDispatcher.BeginInvoke(new Action(add_),…
marc wellman
  • 5,808
  • 5
  • 32
  • 59
4
votes
1 answer

Forcing single-thread access to a resource

Currently I have multiple resources in a project that can only be accessed from a single thread. One example is a ZeroMQ server and another is a Mitsubishi PLC communication module that's not threadsafe. Right now I create a seperate thread for any…
mycroes
  • 645
  • 8
  • 20
4
votes
2 answers

UI freezes on heavy calculation

I am loading huge files to the memory but on this calculation my application is freezes . Any idea what is the issue with my code ? public void Drop(DragEventArgs args) { BackgroundWorker worker = new BackgroundWorker(); string fileName =…
Night Walker
  • 20,638
  • 52
  • 151
  • 228
4
votes
3 answers

Dispatcher.Invoke() on Windows Phone 7?

In a callback method I am attempting to get the text property of a textBox like this: string postData = tbSendBox.Text; But because its not executed on the UI thread it gives me a cross-thread exception. I want something like…
Lemontongs
  • 185
  • 3
  • 7
4
votes
1 answer

Dispatcher.Invoke() is not working for the application

I am working on a project of my company in which they used Dispatcher.Invoke() in many places.If I am using BeginInvoke instead of Invoke then the Synchronisation between threads working fine but in case of Invoke the application is freezing and…
SharpUrBrain
  • 3,180
  • 5
  • 38
  • 56
4
votes
1 answer

Advice on using the Dispatcher Priority and Binding

In my application I'm using the idle-time of the UI thread to offload expensive operations as described by MSDN article on the WPF Threading Model. GenerateDataAction = () => { GenerateData(); }; Dispatcher.BeginInvoke(GenerateDataAction,…
Dennis
  • 20,275
  • 4
  • 64
  • 80
4
votes
2 answers

D3DImage.Lock() causes the dispatcher to process and fire other events

I wrote a WPF application that uses D3dImage class, I subscribed to CompositionTarget.Rendering event and I update the content displayed with the following…
Simone
  • 71
  • 4
4
votes
2 answers

WPF, MVVM, and Asynchronous work

I know this question has been asked here before, but I've read through several answers that haven't helped me. I have a ComboBox that needs to get some information related to a selection from a database (probably on lost focus, to stop a thousand…
Kyeotic
  • 19,697
  • 10
  • 71
  • 128
4
votes
2 answers

Why use Dispatcher.BeginInvoke?

I have seen (and read) about using Dispatcher.BeginInvoke to ensure that UI updates occur on the UI thread. I understand this reasoning. But I have seen examples where in the view code-behind, assigning properties, such as the Text property for a…
AlvinfromDiaspar
  • 6,611
  • 13
  • 75
  • 140
4
votes
1 answer

Does a Non UI thread which is running under impersonated user automatically imersonate the UI thread?

I have been searching for several hours now and have so far had no luck with this one - so thought I would post. I have a WPF Application written in vb.net running on DotNet 4.0 which launches worker threads to perform specific functions such as…
Roddles
  • 307
  • 1
  • 2
  • 10
4
votes
1 answer

Discord Music Bot joins voice channel, light up green but didnt has any audio. Worked well for 2 weeks before. No errors in console

I coded a bot with node.js. I used the example by Crawl for his music bot. I did everything similar to him. After I finished my build everything worked. Every other command and the play command. But now after 2 weeks the bot joins the voice channel,…
FeX
  • 41
  • 3