Installer.OnBeforeInstall 方法
引发 BeforeInstall 事件。
**命名空间:**System.Configuration.Install
**程序集:**System.Configuration.Install(在 system.configuration.install.dll 中)
语法
声明
Protected Overridable Sub OnBeforeInstall ( _
savedState As IDictionary _
)
用法
Dim savedState As IDictionary
Me.OnBeforeInstall(savedState)
protected virtual void OnBeforeInstall (
IDictionary savedState
)
protected:
virtual void OnBeforeInstall (
IDictionary^ savedState
)
protected void OnBeforeInstall (
IDictionary savedState
)
protected function OnBeforeInstall (
savedState : IDictionary
)
参数
- savedState
IDictionary,它包含在安装 Installers 属性中的安装程序之前计算机的状态。此时,该 IDictionary 对象应为空。
备注
在调用此实例的 InstallerCollection 中的安装程序的 Install 方法之前,调用此方法。
引发事件时会通过委托调用事件处理程序。有关更多信息,请参见 引发事件。
OnBeforeInstall 方法还允许派生类对事件进行处理而不必附加委托。这是在派生类中处理事件的首选技术。
给继承者的说明 在派生类中重写 OnBeforeInstall 时,一定要调用基类的 OnBeforeInstall 方法,以便已注册的委托对事件进行接收。
示例
下面的示例说明 OnBeforeInstall 方法。在派生类中重写此方法。提供了在 OnBeforeInstall 方法中添加安装前执行的步骤的空间。
' Override the 'OnBeforeInstall' method.
Protected Overrides Sub OnBeforeInstall(savedState As IDictionary)
MyBase.OnBeforeInstall(savedState)
' Add steps to be done before the installation starts.
Console.WriteLine("OnBeforeInstall method of MyInstaller called")
End Sub 'OnBeforeInstall
// Override the 'OnBeforeInstall' method.
protected override void OnBeforeInstall(IDictionary savedState)
{
base.OnBeforeInstall(savedState);
// Add steps to be done before the installation starts.
Console.WriteLine("OnBeforeInstall method of MyInstaller called");
}
// Override the 'OnBeforeInstall' method.
protected:
virtual void OnBeforeInstall( IDictionary^ savedState ) override
{
Installer::OnBeforeInstall( savedState );
// Add steps to be done before the installation starts.
Console::WriteLine( "OnBeforeInstall method of MyInstaller called" );
}
// Override the 'OnBeforeInstall' method.
protected void OnBeforeInstall(IDictionary savedState)
{
super.OnBeforeInstall(savedState);
// Add steps to be done before the installation starts.
Console.WriteLine("OnBeforeInstall method of MyInstaller called");
} //OnBeforeInstall
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见。
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
Installer 类
Installer 成员
System.Configuration.Install 命名空间
OnAfterInstall
OnAfterRollback
OnAfterUninstall
OnCommitting
OnCommitted
OnBeforeRollback
OnBeforeUninstall