Installer.OnBeforeInstall(IDictionary) 方法

定义

引发 BeforeInstall 事件。

protected:
 virtual void OnBeforeInstall(System::Collections::IDictionary ^ savedState);
protected virtual void OnBeforeInstall(System.Collections.IDictionary savedState);
abstract member OnBeforeInstall : System.Collections.IDictionary -> unit
override this.OnBeforeInstall : System.Collections.IDictionary -> unit
Protected Overridable Sub OnBeforeInstall (savedState As IDictionary)

参数

savedState
IDictionary

包含安装属性中的IDictionary安装程序之前计算机的状态的一个Installers。 此时此 IDictionary 对象应为空。

示例

以下示例演示了该方法 OnBeforeInstall 。 此方法在派生类中被重写。 提供空间以添加在方法中 OnBeforeInstall 安装之前要执行的步骤。

   // 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 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 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

注解

在调用此实例Install中的安装程序的方法之前InstallerCollection调用此方法。

引发事件会通过委托调用事件处理程序。 有关详细信息,请参阅 处理和引发事件

该方法 OnBeforeInstall 允许派生类在不附加委托的情况下处理事件。 这是处理派生类中的事件的首选技术。

继承者说明

在派生类中重写 OnBeforeInstall(IDictionary) 时,请务必调用基类的方法,以便已注册的 OnBeforeInstall(IDictionary) 委托接收事件。

适用于

另请参阅