Dynamic equivalent of CommandHandler attribute?

Topics: CAB & Smart Client Software Factory
Dec 9, 2005 at 12:56 PM
originally posted by: jhershauer

Hi,
What's the dynamic equivalent of putting the CommandHandler attribute on a method? I want to be able to dynamically point to a particular handler right after I make my AddInvoker() call.

Thanks,
Jeff
Dec 10, 2005 at 7:06 AM
originally posted by: jhershauer

What I ended up doing was simply assigning my event handler to command ExecuteAction like this:

m_WI.CommandsvProfile.Modules[i].ViewName.AddInvoker(vMI, "Click");
m_WI.CommandsvProfile.Modules[i].ViewName.ExecuteAction += this.ShowMainView;

Basically, this is a snippet of code from a routine that loops through a manifest and creates menu items for each "view". I can then use the Command Name as my context in ShowMainView() in order to know which view to launch. Hopefully this reasonably follows a "best practice" for this type of command functionality.