Question

I am relatively new to VS and C# but have years of experience in Delphi. One of the my favorite components when designing GUI in Delphi is ActionManager - centralized way to assign event handlers for actions as well as enabling/disabling them. Surprisingly, I can't find anything like this in Visual Studio 2008 Professional. I am sure that there should be third party implementations but I'd prefer something standard.

Can anybody suggest me something for this? Maybe there is some alternate way to effectively manage GUI actions that I am missing?

Was it helpful?

Solution

In WPF there are Commands, which are conceptually similar.

OTHER TIPS

I loved ActionManager, too. I did not know it at that time, but all it is is a fancy implementation of Model-View-Controller. In hindsight, Delphi was too advanced for an unprepared developer community 8-)

Back to your question, C# has the concept of events and delegates, which are equivalent to actions and their handlers. You tie control events (or GUI actions) to delegates. For example,

mybutton.Click += HandleMyButtonClick;

Click would be a delegate with the signature void (object sender, EventArgs e). This signature would be followed by the HandleMyButtonClick method, like this.

void HandleMyButtonClick(object sender, EventArgs e)

Under the class documentation of controls, there will be a section listing all the events that are raised. These events will also describe the signature of the delegates required to handle them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top