Trouble Getting Actions Implementationsto Register

Topics: CAB & Smart Client Software Factory
Dec 13, 2006 at 7:06 AM
originally posted by: dbranscombe

Can anyone help me with getting my Action Implementations registered. I have followed the sample for using Action Catalogs. It seems to register the action and check it for execution. But then in the ActionCatalogService it gets hung up on the code: if (_actionImplementations.TryGetValue(action, out actionDelegate))
{
actionDelegate(caller, target);
}
because the _actionImplementations dictionary is empty. I have my action set up with the attribute as directed:
Action(Constants.ActionNames.ShowMyView) and don't know where else to look.

What am I missing?
Thanks for the help!
Dec 13, 2006 at 7:18 AM
originally posted by: matiaswoloski

Can you paste the code below the Action attribute? Make sure the method has the correct signature

public void ShowMyViewAction( object caller, object target ) ...

Thanks
Matias
http://staff.southworks.net/blogs/matiaswoloski
Dec 13, 2006 at 7:22 AM
originally posted by: dbranscombe

Here's the full method:
Action(Constants.ActionNames.ShowMyView)
public void ShowMyView(object caller, object target)
{
ITestView view = WorkItem.Items.AddNew<TestView>();
WorkItem.WorkspacesConstants.WorkspaceNames.RightWorkspace.Show(view);
}

Thanks for your help!
Dwight
Dec 13, 2006 at 9:10 AM
originally posted by: matiaswoloski

Are you adding the ActionStrategy to the builder?

In your FormShellApplication derived class override AddBuilderStrategies and do something like

builder.AddStrategy<ActionStrategy>();
Dec 13, 2006 at 10:36 AM
originally posted by: dbranscombe

Do you mean the ShellApplication class in the Shell project? If so, I added it here and says there is no suitable method found to override. This is what I added:
protected override void AddBuilderStrategies ()
{
builder.AddStrategy<ActionStrategy>();
}
Dec 13, 2006 at 10:45 AM
originally posted by: matiaswoloski

protected override void AddBuilderStrategies(Builder builder)
{
base.AddBuilderStrategies(builder);
builder.Strategies.AddNew<ActionStrategy>(BuilderStage.Initialization);
}
Dec 13, 2006 at 11:20 AM
originally posted by: dbranscombe

That did it. Thank You!!! I must've missed the instructions on this....

How does the BankBranchWorkbench system do it? I didn't see the same code there.

Thanks again for your help!
Dec 13, 2006 at 11:25 AM
originally posted by: matiaswoloski

I think that was part of the SmartClientApplication class on the Infrastructure.Library project.
You can Find in Files in Visual Studio and look for that line.