You can use Dispatcher
even in a WinForms app.
If you are sure to be on a UI thread (e.g. in an button.Click handler), Dispatcher.CurrentDispatcher
gives you the UI thread dispatcher that you can later use to dispatch from background threads to the UI thread as usual.
More Related Contents:
- Invoke or BeginInvoke cannot be called on a control until the window handle has been created
- Dispatcher Invoke(…) vs BeginInvoke(…) confusion
- In WinForms, why can’t you update UI controls from other threads?
- WinForm Application UI Hangs during Long-Running Operation
- Question about terminating a thread cleanly in .NET
- How do I create a C++/CLI Winforms app in VS2012?
- BackgroundWorker vs background Thread
- Winforms-How can I make MessageBox appear centered on MainForm?
- How to update GUI with backgroundworker?
- Is it safe just to set CheckForIllegalCrossThreadCalls to false to avoid cross threading errors during debugging?
- Writing to a TextBox from another thread? [duplicate]
- Multi-threaded splash screen in C#?
- Formatting text in WinForm Label
- How to update textbox on GUI from another thread [duplicate]
- The calling thread cannot access this object because a different thread owns it.WPF [duplicate]
- How to disable a WinForms TreeView node checkbox?
- Windows forms – add data to list view on button click [duplicate]
- How to draw custom button in Window Titlebar with Windows Forms?
- Stop comboBox’s selectedIndexChanged event from firing when the form loads
- Spawn a new thread to open a new window and close it from a different thread
- Max Char in TextBox C#?
- “The calling thread must be STA, because many UI components require this” error when creating a WPF pop-up Window in thread
- Adding button into a Listview in WinForms
- WinForms how to call a Double-Click Event on a Button?
- WPF BackgroundWorker vs. Dispatcher
- Multiple UI Threads – Winforms
- InvalidOperationException – object is currently in use elsewhere – red cross
- Why does the inner exception reach the ThreadException handler and not the actual thrown exception?
- Draw on a form by a separate thread
- How do I get the UI thread’s Dispatcher?