|Re: Property testers Versus Source Providers [message #655138 is a reply to message #655041]
||Fri, 18 February 2011 13:26
| Paul Webster
Registered: July 2009
On 02/18/2011 02:09 AM, Saurabh wrote:|
> I find that Menu contributions can be enabled with property testers as
> well as with Source Providers. What is the difference in enabling
> commands with these two techniques?
> Which one is a better way to enable /disable commands?
Source providers provide variables to the system. It's event driven,
and variables are available in visibleWhen,enabledWhen,activeWhen (they
have a priority). They're also available from the
IEvaluationContext/ExecutionEvent in the handlers.
The active handler controls the enabled state of its command, and has
access to the IEvaluationContext/ExecutionEvent. It does not have
access to properties, except when used as part of an enabledWhen clause
for that handler.
properties can be used in the core expressions, though the property
testers. But they are not event drive. If a property changes, some
external entity has to go through
which will cause all core expressions that contain that property to
One way to look at it: You would create a source provider to make a
variable available: ex: a Person object, or an ID Employee. You would
use a property tester to examine some aspects of the object, like a
Person's name or Employee's shift ... but a "shift" as a variable by
itself doesn't make much sense.
Powered by FUDForum
. Page generated in 0.01614 seconds