Command Handler Execute

Topics: CAB & Smart Client Software Factory
Jul 20, 2006 at 1:16 AM
originally posted by: kiavik

it's possible run a Command with Execute Method?


and in a Workitem class:
public void ViewLoginBar(object sender, EventArgs e)

this method not fired, why??
Jul 20, 2006 at 9:28 PM
originally posted by: KayLerch

There is nothing wrong with your code.

Make sure that :
- the Command is in your WorkItem
- the Execute()-codeline ist accessed

some debugging might help.

kind regards,
Kay Lerch
Jul 20, 2006 at 10:27 PM
originally posted by: kiavik

hi kay...
the command is present in Workitem and codeline is accessed

any other suggest?

Jul 21, 2006 at 1:17 AM
originally posted by: KayLerch

Did you change the CommandStatus to disabled?
Check the state of your command (it has to be enabled).

when debugging, check if :
- the WorkItem is able to return the CommandCollection
- the Command is in that(!) collection
- the Command.OnExecuteAction is accessed

kind regards,
Jul 21, 2006 at 3:33 AM
originally posted by: kiavik

the Status is Enabled
Workitem Contains the Command and OnExecution start

instead Workitem.CommandsModule.Adapters.Count is 0, it can be this the problem?

in my beahviour the codeline :
is on a singleton class, executed from a WorkitemClass
but Workitem (in debug) is correct

what wrong?
Jul 28, 2006 at 10:04 AM
originally posted by: Tex47


got nearly the same problem.
When creating a CommandHandler in a module and try to execute the command from the shell RootWorkItem, nothing happens. The command is visible in the Commands collection from the shell RootWorkitem, but no ExecuteAction is set. To execute the command, I used the workitem from the module like
- RootWorkItem.WorkItems"MyModuleWorkItem".Commands"MyModuleCommand".Execute()
and that works fine.
The only thing is, that you better name your module WorkItem with a strong name as ID instead of the GUID, otherwise you have to find it by it's type.

Why the command is "visible" at the RootWorkItem but can't be executed, I don't know.

Hope that helps