This project is read-only.

Unable to execute Command

Aug 27, 2007 at 5:33 PM
I am new to SCSF and trying my hands on CommandHandler. I have a scenario where I have 2 workitems (winform controls) one is a navigation control and one is a client list control. I wanted to invoke the client module when a particular item in the navigation control is clicked.
I also have a menu item ( in shell layout) whick invokes the client list control. It works fine. But when I want to invoke the command from another workitem the command is not recognized at runtime.
I have the following code in modulecontroller.cs of client module

public void OnShowClientMenuMessage(object sender, EventArgs e)
ClientView view = WorkItem.SmartParts.AddNew<ClientView>("Client");


and I have the following code in the navigationview.cs
private void explorerbarOptions_ItemClick(object sender, Infragistics.Win.UltraWinExplorerBar.ItemEventArgs e)
if (e.Item.Key == "clientlist")


what am i doing wrong? Any help will be appreciated.
Sep 4, 2007 at 9:57 PM
Edited Sep 4, 2007 at 9:57 PM
if _presenter.WorkItem.Commands [Constants.CommandNames.ShowClientMenuItemMessage] is not found, it means that it is not there (duh). I can think of two reasons: _presenter workitem commands collection has not been yet initialized (unlikely), or presenter.WorkItem and WorkItem in your modulecontroller.cs are not the same work item (more likely). Put a breakpoint in your *ItemClick method, and browse _presenter.WorkItem up to see if the command is present in the workitem itself or parent work item. I suspect that modulecontroller's workitem is not in the _presenter's workitem ancestors tree.