Thursday, November 11, 2004

Application Event Handler Component (AEHC)

Ever wondered writing an HTTP Handler for WinForms

"Today, I am writing an Application Event Handler Component (AEHC) for any WinForm Application in .NET. AEHC is an event handler for your winforms application, The primary functionality of this component is to raise an event after every forms load into memory. So that we can handle its event for performing any custom code processing and return the control to the form after processing.

Let's consider a scenario, While implementing security into our application, we may have to disable or enable certain controls on every form according the role of the user accessing the form. For this we will call a custom method [for an instance AuthorizeMe()] to perform custom authentication and authorization from each and every form in our application. Suppose if in any case we forget to call its method from one of our form, in result there will be no security applied to that form.

Now, with AEHC we only call the method AuthorizeMe() once per application from AEHC and then its AEHC's responsibility to execute AuthorizeMe() every time, after the form is loaded.

..."

Interesting. Seems like the Application events in VB2K5 but extended... I like the concept and can see a number of ways these (form loaded/unloaded events) and related events could be useful.

Will be watching as this matures.

Update #1 11/15/2004 @ 5:24 PM PST:
Looks like he's done....

He's also done a nice write up on CodeProject, http://www.codeproject.com/vb/net/aeh.asp

No comments: