Well, don't call the delegate directly. Do use Invoke() (or
BeginInvoke()). But yes, don't bother checking whether invoking is
required. If it's not, it's only slightly more overhead to do the invoke
anyway, and presumably this code is in a place where practically all the
time you'd need to invoke anyway.
Of course, all this assumes you're using a System.Windows.Forms control,
where calling Invoke() would be required. Seeing as you've said this isa
Window, not a Form, and that you're using WPF, the above advice may not be
applicable at all.
Note: I did a quick search, and found this article:
http://msdn2.microsoft.com/en-us/library/ms741870.aspx
If I read it correctly, it appears that WPF shares the same cross-thread
issues that exist for a Forms-based application, but address them in a
different way. Instead of there being an Invoke() method on the
individual controls, there's a Dispatcher object that you use to call
Invoke(). You can get this Dispatcher from the WPF object using the
Dispatcher property (inherited from the DispatcherObject class) of your
WPF controls (and maybe from the Window as well...I didn't look).
I note that in the Dispatcher class, there's no direct way to find out
whether the Dispatcher is for the current thread or not. It has a Thread
property, and you could compare that to the current Thread instance. But
that's a bit awkward. It appears they expect you to just call Invoke()
without checking to see whether doing so is required.
In other words, it looks like the folks who designed WPF agree with me on
the InvokeRequired property question.
Pete