This project is read-only.

Is there any way to Intercept Events?(Without code changes)

Aug 23, 2010 at 11:55 PM

I would like to know if there is any way to intercept events of an application. I mean, I have an application but I can't make any changes in its code so I have the name of one of the controls in a form(a button for example). Well, I want to associate the "Click" event of this button to an extension point without making any changes in the event handler code of this button.

As I am not good at English I am going to try to explain you with an example.

The Root project has:
A form FromA that has a button ButtonB in which the event "Click" has been programmed and also an Interface for an add-in command ICommand. The interface ICommand is part of the Addin features(it has a method execute).

The Addin project has:
The implementation of this command(ICommand).

What I want to do is:
From the Add-in Project I want to override the event "Click" of the ButtonB in the FormA without forcing any dependency between those projects. Also, when I click on ButtonB it should execute the extension point of ICommand.execute

In short words
Is there any way to declare event interceptor for controls? in Mono Addin project