Question about using Infastructure.Layout

Topics: CAB & Smart Client Software Factory
Jan 25, 2007 at 11:15 PM
I had my project up and working perfectly until I wanted to try and do some modal views, at which point I found out I needed to use the Infrastructure.Layout module, which I hadn't been using before. I moved my code over and got it rigged up, and it works, except for one thing.

I'm using a launchbar in my project, and I was adding a button to the launchbar before in the ModuleController of my module. When I started using Infrastructure.Layout, it claimed that my LaunchBar extension site did not exist, but if I moved my code to add the launch bar button to the ShellLayoutViewPresenter file, and call the function from the OnViewSet function, it added the icon, but the command I had associate with it does not work, as it's housed in the ModuleController.

So my question is, is there something special I need to do in order to add what I want from the ModuleController to the Layout?

Here is my function to add the button to the LaunchBar. It's crashing on WorkItem.UIExtensionSitesConstants.UIExtensionSiteNames.LaunchBar.Add.

private void AddLaunchBarButton(string commandName, Image patientIcon, string patientViewText)
ToolStripButton element = new ToolStripButton();
element.TextImageRelation = TextImageRelation.ImageAboveText;
element.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
element.ImageScaling = ToolStripItemImageScaling.None;
element.Image = patientIcon;
element.Text = patientViewText;

WorkItem.CommandscommandName.AddInvoker(element, "Click");