Re: Raising UI-level events from a thread without using Invoke?
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Tue, 20 Feb 2007 16:54:40 +0800
On Mon, 19 Feb 2007 12:25:25 +0800, Bruce Wood <brucewood@xxxxxxxxxx> wrote:
Most of the "classic" Invoke examples I've seen do this in order to re-
use the same routine as Invoked or not Invoked, viz: the routine
checks InvokeRequired and, if it's true, Invokes "itself", so the
second go around InvokeRequired will be false and the "else" part will
execute the actual machinery of the method.
That's true. But I don't see the advantage of keeping all the code in a single routine. Everyone can still call an invoking rotine, and the invoking routine can use a separate delegate method to do the actual work.
In fact, to my eye having a single method have two entirely different behaviors goes against my general coding principles. It's not terrible in this case, but it's not pretty either. :)
Of course, if you use two methods: a facade that calls Invoke and
another method that does the actual work, there's no real need to
check InvokeRequired in the first routine.
Exactly! :)
Pete
.
- References:
- Raising UI-level events from a thread without using Invoke?
- From: Thomas Due
- Re: Raising UI-level events from a thread without using Invoke?
- From: Thomas Due
- Re: Raising UI-level events from a thread without using Invoke?
- From: Brian Gideon
- Re: Raising UI-level events from a thread without using Invoke?
- From: Peter Duniho
- Re: Raising UI-level events from a thread without using Invoke?
- From: Bruce Wood
- Raising UI-level events from a thread without using Invoke?
- Prev by Date: Re: getting at users outlook inboxes programmatically
- Next by Date: Re: adding one element to a fixed array []
- Previous by thread: Re: Raising UI-level events from a thread without using Invoke?
- Next by thread: Re: Raising UI-level events from a thread without using Invoke?
- Index(es):
Relevant Pages
|