Module 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供用戶端中所有擴充性物件的主要進入點。
public ref class Module abstract : IDisposable, IServiceProvider
public abstract class Module : IDisposable, IServiceProvider
type Module = class
interface IServiceProvider
interface IDisposable
Public MustInherit Class Module
Implements IDisposable, IServiceProvider
- 繼承
-
Module
- 實作
範例
下列範例示範如何建立衍生自 類別的 Module 模組。
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);
}
給實施者的注意事項
當您繼承自 Module 時,您必須覆寫下列成員:Tasks 和 Initialize(IServiceProvider, ModuleInfo)。
建構函式
| Module() |
初始化 Module 類別的新執行個體。 |
欄位
| FxVersion10 |
表示 .NET Framework 1.0 版。 |
| FxVersion11 |
表示 .NET Framework 1.1 版。 |
| FxVersion20 |
表示 .NET Framework 2.0 版。 |
| FxVersionNotRequired |
表示不需要.NET Framework。 |
屬性
| MinimumFrameworkVersion |
取得模組所需的最低.NET Framework版本。 |
| ModuleInfo |
ModuleInfo取得傳遞至 方法的 Initialize(IServiceProvider, ModuleInfo) 實例。 |
| Tasks |
在衍生類別中覆寫時,取得模組的工作清單。 |
方法
| Dispose() |
釋放 Module 所使用的所有資源。 |
| GetService(Type) |
擷取所要求的服務。 |
| Initialize(IServiceProvider, ModuleInfo) |
在衍生類別中覆寫時,初始化模組。 |
| IsPageEnabled(ModulePageInfo) |
傳回值,指出是否啟用模組的指定頁面。 |
明確介面實作
| IDisposable.Dispose() |
如需此成員的描述,請參閱 Dispose() 。 |
| IServiceProvider.GetService(Type) |
如需這個成員的說明,請參閱 GetService(Type)。 |