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

What is a DispatcherFrame and how do I use it?

Here's the code provided by MSDN, although it doesn't appear to be clear on what it's doing: [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] public void DoEvents() { DispatcherFrame frame = new…
William
  • 1,837
  • 2
  • 22
  • 36
8
votes
1 answer

No NullPointerException in JSTL when calling methods on null object associated with request object.why?

Yesterday I appeared in an interview. The interviewer shows me this code and asked- Why there is no null pointer, while the value of hobby is null Code is as- In Sevlet…
user4768611
8
votes
2 answers

'System.ArithmeticException' while updating layout

This happens only in x64 version An unhandled exception of type 'System.ArithmeticException' occurred in WindowsBase.dll Additional information: Overflow or underflow in the arithmetic operation. Crashing at…
Daniel
  • 1,064
  • 2
  • 13
  • 30
8
votes
5 answers

Change WPF mainwindow label from another class and separate thread

Im working on a WPF application. I have a label called "Status_label" in MainWindow.xaml. and I want to change its content from a different class (signIn.cs). Normally I'm able to do this var mainWin =…
iJay
  • 4,205
  • 5
  • 35
  • 63
7
votes
1 answer

Unit testing COM events?

We have a home-made COM component written in C++. We now want to test its functions and events in a C# Test Project. The function tests are pretty straight-forward. However, the events are never triggered. MyLib.MyClass m = new…
l33t
  • 18,692
  • 16
  • 103
  • 180
7
votes
3 answers

Force redraw before long running operations

When you have a button, and do something like: Private Function Button_OnClick Button.Enabled = False [LONG OPERATION] End Function Then the button will not be grayed, because the long operation prevents the UI thread from repainting…
Maestro
  • 9,046
  • 15
  • 83
  • 116
7
votes
2 answers

Why does WPF's Dispatcher.Invoke not cause a deadlock when run on the main thread?

Consider the code: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void button_Click(object sender, RoutedEventArgs e) { …
Frank Adams
  • 103
  • 4
7
votes
2 answers

WPF Update UI From RefreshEvent

I actually try to update the MainWindow UI from a RefreshEvent in a external class. I tried out the following, but the UI doesnt refresh. System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate …
Philipp Nies
  • 945
  • 4
  • 20
  • 38
7
votes
2 answers

Calling BeginInvoke from a destructor

I have some code in a WPF application that looks like this: public class MyTextBox : System.Windows.Controls.TextBox, IDisposable { public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected…
JonDrnek
  • 1,414
  • 3
  • 19
  • 37
7
votes
1 answer

DoEvents: Dispatcher.Invoke vs. PushFrame

Recently I found a method that performs all pending messages in the dispatcher queue until a specified priority. I already had such code before, but they use completely different methods. Here's both of them: The PushFrame way: /// ///…
ygoe
  • 18,655
  • 23
  • 113
  • 210
7
votes
2 answers

Is it possible to recursively flush directories in the CQ5/AEM apache dispatcher?

I have a dispatcher set up with a fairly deep stats file level due to a particular project in a multi tenancy situation. What I'm hoping is for a way to be able to recursively flush directories to mimic a more shallow stats file level for the other…
Bayani Portier
  • 660
  • 8
  • 18
7
votes
3 answers

How can I exit (stop) my Dispatcher?

I would like to stop my dispatcher which has been started in the main(), when the user clicks a button. private void button_start_Click(object sender, RoutedEventArgs e) { ... Camera.EventFrame -= onFrameEventFocusCam; …
Norick
  • 271
  • 5
  • 20
7
votes
4 answers

Getting the right WPF dispatcher in a thread

In the constructor of an object i need to create a WPF mediaElement object: m_videoMedia = new MediaElement(); but the class can also be instantiated from a other thread so i need to use Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(()…
Bert
  • 71
  • 1
  • 1
  • 2
7
votes
1 answer

NameError: name 'app' is not defined with Flask

I have the following structure in my project \ myapp \ app __init__.py views.py run.py And the following code: run.py from app import create_app if __name__ == '__main__': app = create_app() app.run(debug=True,…
zot24
  • 323
  • 1
  • 5
  • 15
7
votes
1 answer

how do I convert wpf dispatcher to winforms

I was moving over a method to my winforms project from a wpf project. Everything but this section was moved without issue: private void ServerProcErrorDataReceived(object sender, DataReceivedEventArgs e) { // You have to do this through the…
ErocM
  • 4,505
  • 24
  • 94
  • 161