I'm developing my first MMC SnapIn. I'd like to have per SnapIn configuration information. I need to access that information from the SnapIn panel controls. I don't see any way to find the parent SnapIn object from those controls. Is there a method other than creating a static global?
The FormViewDescription that's part of the SnapIn seems to create the controls using a default constructor:
// Create a form view for the root node.
FormViewDescription fvd = new FormViewDescription();
fvd.DisplayName = "Status";
fvd.ViewType = typeof(SelectionFormView);
fvd.ControlType = typeof(SelectionControl);
Thanks
In your control (
SelectionControl
) you can implement theMicrosoft.ManagementConsole.IFormViewControl
interface. You then receive a call to yourInitialize
method with theFormView
as argument. From this argument you can access the SnapIn.Here's a sample:
[EDITED]
You can use the following class as the base class of your control instead of
UserControl
:(This will also resize the control inside it's parent.)
Be careful: Do not access the
SnapIn
property in the constructor of your class. Use theOnInitialize
method instead.