Greetings all,
I have a CAB project using the UltraWinToolBarManager that has three blank toolbars (Main/LaunchBar/ToolBar). I want to add/remove/hide buttons based on workitem, and permissions. When I tried to load my first view, and wire up the click event I get the following error:
Unable to access the specified event for the specified invoker.
OK, so here's my setup:
In my Infrastructure.Interface.WorkItemController class I have the following:
protected void AddLaunchBarItem(string commandName, System.Drawing.Image moduleIcon, string moduleTitle, string
toolTipText)
{
ButtonTool button = new ButtonTool (commandName);
button.CustomizedImage = moduleIcon;
button.CustomizedCaption = moduleTitle;
button.SharedProps.ToolTipText = toolTipText;
WorkItem.UIExtensionSites[Constants.
UIExtensionSiteNames
.MainLaunchBar].Add(button);
WorkItem.Commands[commandName].AddInvoker(button,
"Click"
);
which is called from my ModuleController:
ExtendLanchBar()
AddLaunchBarItem(
.ModuleTitle);
where I also have a command handler registered:
[
CommandHandler(CommandNames.HLAXBROWSER)]
e)
.WaitCursor;
ShowViewInWorkspace<
.MainWorkspace);
.Default;
Could someone tell me what I am doing wrong?
Mark Rooney said: WorkItem.Commands[commandName].AddInvoker(button, "Click");
WorkItem.Commands[commandName].AddInvoker(button, "Click");
The ButtonTool class doesn't contain a definition for the Click event. The event you are looking for is ToolClick:
WorkItem.Commands[commandName].AddInvoker(button, "ToolClick");
This way it should work.
HTH,
Emanuel