I'm making an Autocad Plugin
which runs fine using Windows Forms
And I've created a user control (winforms)
to replicate in any form I like in the future.
The question is
From the control's code, how do I get the instance of the application running that control?
(Probably a pure winforms problem)
Coditions:
Within the plug-in I can get the Autocad Application instance with no problem.
This user control is meant to be in a separate assembly (dll)
to be referenced in the plug-in application, so it has no direct access to the application instance.
A little explanation about the scenario:
There's a Main Assembly
being run by Autocad as a plug-in.
That assembly has the Autocad application instantiated.
Now I have some useful form controls to work with Autocad, and they are in a separate assembly
. (That's because I want to use them in as many different plug-ins I like).
So, Autocad runs main assembly
, and main assembly
runs controls of the separate assembly
.
In order to work properly, those controls need to have access to the Autocad application wich is running the main assembly
.
Today I use the application as a property in the controls, wich I must set before working with them. (If I forget to set that, exceptions are raised). Since I cannot have a control with a creator taking parameters.
I want the controls to detect their running application so I avoid that workaround.