Share via


Module.Initialize(IServiceProvider, ModuleInfo) Method

Definition

When overridden in a derived class, initializes the module.

protected public:
 virtual void Initialize(IServiceProvider ^ serviceProvider, Microsoft::Web::Management::Server::ModuleInfo ^ moduleInfo);
protected internal virtual void Initialize (IServiceProvider serviceProvider, Microsoft.Web.Management.Server.ModuleInfo moduleInfo);
abstract member Initialize : IServiceProvider * Microsoft.Web.Management.Server.ModuleInfo -> unit
override this.Initialize : IServiceProvider * Microsoft.Web.Management.Server.ModuleInfo -> unit

Parameters

serviceProvider
IServiceProvider

The IServiceProvider to initialize.

moduleInfo
ModuleInfo

The ModuleInfo that contains initialization data.

Examples

The following example shows how to override the Initialize method in a derived class. Note that you must first call the base class method before performing other processing.


internal class DemoModule : Microsoft.Web.Management.Client.Module 
{

    protected override void Initialize(
        IServiceProvider serviceProvider, ModuleInfo moduleInfo) 
    {

        base.Initialize(serviceProvider, moduleInfo);
        Trace.WriteLine(" ClientModuleTypeName : " + 
            moduleInfo.ClientModuleTypeName);
        Trace.WriteLine(" Name : " + moduleInfo.Name);
        
        // Clear the trace window.
        resetTrace();

        IControlPanel controlPanel = 
            (IControlPanel)GetService(typeof(IControlPanel));
        ModulePageInfo modPgInfo = getModulePage();

        controlPanel.RegisterPage(modPgInfo);
        controlPanel.RegisterPage(
            ControlPanelCategoryInfo.HealthAndDiagnostics, modPgInfo);

        /// The ExtensibilityManager is used to add a new icon/element 
        /// to the InetMgr UI in the Connections frame.

        IExtensibilityManager extensMgr = 
            (IExtensibilityManager)GetService(
            typeof(IExtensibilityManager));
        System.Diagnostics.Debug.Assert(extensMgr != null);

        extensMgr.RegisterExtension(typeof(HierarchyProvider), 
            new DemoHierProvidr(serviceProvider));

        ICollection extenCol = 
            extensMgr.GetExtensions(typeof(HierarchyProvider));
        Trace.WriteLine(
            "extensMgr collection cnt = " + extenCol.Count.ToString());
        foreach (HierarchyProvider col in extenCol) 
        {
            Trace.WriteLine(col.ToString());
        }
        
        traceModInfo(modPgInfo);
    }

Notes to Inheritors

You must override this method in a derived class and call the base class method before performing other initialization operations.

Applies to