Reputation: 11
How to clear previous not already executed BeginInvoke on a ui control before adding a new begin invoke.
In my WinForm application I've a status bar that I update frequently from a background process, but if I use Invoke I slow down background process performance, so I want to use begin invoke, but I want that status is synchronized with the last BeginInvoke. So when I call a new BeginInvoke I want to clear previous not already executed BeginInvoke.
Is there any way to do this?
Upvotes: 0
Views: 266
Reputation: 1099
If you call BeginInvoke so often that your UI thread does not event manage to dequeue the invocation, than you should consider either lowering the frequency of calling BeginInvoke, or changing the method of updating the UI (timer?). Also agreed with Lasse's comment.
Upvotes: 0