Questions tagged [begininvoke]

The Windows-specific Dispatcher.BeginInvoke API method

The Windows-specific Dispatcher.BeginInvoke API method.

This API call asynchronously runs a delegate on the dispatcher-associated thread.

280 questions
3
votes
1 answer

stop a thread before closing form

Using .NET4, c#, I have a grid on a winform. When I hit a process button, I need to perform a timely operation with a few steps on each row and then update the row with a result. This way the user can see progress while the next row is processing.…
Mike Turner
  • 471
  • 1
  • 7
  • 22
3
votes
3 answers

WhenAll() not working as expected

I need to make UI thread wait until a task array completes execution.The problem with below code is that - the tasks inturn invoke UI thread to write into textbox. How to fix this? public partial class FormConsole : Form { public FormConsole() …
Murali Uppangala
  • 884
  • 6
  • 22
  • 49
3
votes
1 answer

Convert BeginInvoke to async/await

I have a function apiClient.OrderSend that must be called inside the "GUI" thread, so I created this function private void RunOnUIThread(Action action) { this.BeginInvoke(action); } I then have a function that needs to return an…
Ivan
  • 7,448
  • 14
  • 69
  • 134
3
votes
0 answers

How do I identify and resolve memory leaks in WPF's BeginInvoke()?

I'm working a windows .Net C# WPF application. The application displays video frames in addition to displaying some additional analytic data in a canvas. The app is processing a frame rate of about 15 frames per second. Processing is completed on…
JohnB
  • 3,921
  • 8
  • 49
  • 99
3
votes
2 answers

Invoke and Delegates in events - Why does the actions happen in this (unexpected) order?

I had a problem with component events which could be solved by using a delegate. I haven't worked with delegates before, so I tested a little bit and found this strange behaviour: When using delegates the actions happen in a for me completely…
marsh-wiggle
  • 2,508
  • 3
  • 35
  • 52
3
votes
0 answers

C# - Calling BeginInvoke on a control fails to call the delegate

I am faced with an interesting issue that happens on Windows 8.1 while the application runs fine on Windows 7. The problem happens when we call BeginInvoke on a control to switch the execution to the UI thread that created the control in order to…
Adi
  • 31
  • 2
3
votes
2 answers

Delegate, BeginInvoke. EndInvoke - How to clean up multiple Async threat calls to the same delegate?

I've created a Delegate that I intend to call Async. Module Level Delegate Sub GetPartListDataFromServer(ByVal dvOriginal As DataView, ByVal ProgramID As Integer) Dim dlgGetPartList As GetPartListDataFromServer The following code I use in a…
Dan
  • 905
  • 4
  • 10
  • 16
3
votes
2 answers

AdressOf method signature

Since I can't put in parameters, how can I respect the following signature? Private Sub SetFocusToRow(ByRef ultraGridRow As Infragistics.Win.UltraWinGrid.UltraGridRow) grdSoldeOuverture.ActiveCell = ultraGridRow.Cells(0) …
phadaphunk
  • 12,785
  • 15
  • 73
  • 107
3
votes
4 answers

BeginInvoke claims the control's window handle has not been created even though I think it was

In my form's constructor, I call: InitializeComponent(); // boilerplate placed by VS, initializing controls label1.BeginInvoke(new InvokeDelegate(RefreshLabelDelegate)); Yet, I get the dreaded exception with the message: "Invoke or BeginInvoke…
Not So Sharp
  • 1,149
  • 2
  • 10
  • 20
3
votes
7 answers

When is the GUI overloaded?

Suppose you are permanently invoking a method asynchronously onto the UI thread/dispatcher with while (true) { uiDispatcher.BeginInvoke(new Action(insert_), DispatcherPriority.Normal, new object[] { }); } On every run of the program…
marc wellman
  • 5,808
  • 5
  • 32
  • 59
3
votes
2 answers

For a given priority, are Dispatcher.Invoke() and Dispatcher.BeginInvoke() equal?

Given that Invoke() blocks the calling thread until the delegate is executed, I was wondering if it is given any kind of priority over delegates queued by BeginInvoke(), which by definition would infer that timeliness is less important? Anyone know?…
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
2
votes
3 answers

UI still non responsive after using control.begininvoke

i've made a C# winforms application. Now i have a form which has lots of buttons, which call huge number crunching functions whose output i update in a textbox. I call the textbox.begininvoke() method to which i pass a delegate to the function which…
Anirudh Goel
  • 4,571
  • 19
  • 79
  • 109
2
votes
2 answers

Why is Visual Studio 2010 telling me "'System.Delegate' does not contain a definition for 'EndInvoke'"?

Why is Visual Studio 2010 telling me "'System.Delegate' does not contain a definition for 'EndInvoke'" when I call job.Delegate.EndInvoke()? How do I fix it? Note that it likes BeginInvoke() just fine, and doesn't complain if I add EndInvoke()…
sh-beta
  • 3,809
  • 7
  • 27
  • 32
2
votes
1 answer

WPF BeginInvoke and EntityFramework

I have a search through database. Search works in separate thread. When entity is found I have to show it and some of related data into WPF UI. I use EntityFramework. Main idea of search process is: foreach (var item in _currentEntitySet) { …
Renatus
  • 145
  • 1
  • 1
  • 10
2
votes
1 answer

Decoupling caller from callee in C# using delegate/BeginInvoke

In C# I have a hierarchy of classes that perform actions that could potentially take a long time. For this reason, I implemented a decoupling/callback mechanism so the caller is not blocked, but is informed of an action's completion through a…
Jeroen
  • 803
  • 1
  • 7
  • 13