Installer.AfterInstall 事件

Installers 属性中的所有安装程序的 Install 方法都运行后发生。

**命名空间:**System.Configuration.Install
**程序集:**System.Configuration.Install(在 system.configuration.install.dll 中)

语法

声明
Public Event AfterInstall As InstallEventHandler
用法
Dim instance As Installer
Dim handler As InstallEventHandler

AddHandler instance.AfterInstall, handler
public event InstallEventHandler AfterInstall
public:
event InstallEventHandler^ AfterInstall {
    void add (InstallEventHandler^ value);
    void remove (InstallEventHandler^ value);
}
/** @event */
public void add_AfterInstall (InstallEventHandler value)

/** @event */
public void remove_AfterInstall (InstallEventHandler value)
JScript 支持使用事件,但不支持进行新的声明。

示例

下面的示例说明 AfterInstall 事件。它由 OnAfterInstall 方法引发。

' MyInstaller is derived from the class 'Installer'.
Sub New()
   MyBase.New()
   AddHandler AfterInstall, AddressOf AfterInstallEventHandler
End Sub 'New

Private Sub AfterInstallEventHandler(ByVal sender As Object, _
                                    ByVal e As InstallEventArgs)
   ' Add steps to perform any actions after the install process.
   Console.WriteLine("Code for AfterInstallEventHandler")
End Sub 'AfterInstallEventHandler
// MyInstaller is derived from the class 'Installer'.
MyInstaller() : base()
{
   AfterInstall += new InstallEventHandler(AfterInstallEventHandler);
}
private void AfterInstallEventHandler(object sender, InstallEventArgs e)
{
   // Add steps to perform any actions after the install process.
   Console.WriteLine("Code for AfterInstallEventHandler"); 
}
   // MyInstaller is derived from the class 'Installer'.
public:
   MyInstaller()
   {
      AfterInstall += gcnew InstallEventHandler( this, &MyInstaller::AfterInstallEventHandler );
   }

private:
   void AfterInstallEventHandler( Object^ sender, InstallEventArgs^ e )
   {
      // Add steps to perform any actions after the install process.
      Console::WriteLine( "Code for AfterInstallEventHandler" );
   }
// MyInstaller is derived from the class 'Installer'.
MyInstaller()
{
    this.add_AfterInstall(
        new InstallEventHandler(AfterInstallEventHandler));
} //MyInstaller

private void AfterInstallEventHandler(Object sender, InstallEventArgs e)
{
    // Add steps to perform any actions after the install process.
    Console.WriteLine("Code for AfterInstallEventHandler");
} //AfterInstallEventHandler

.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 命名空间
BeforeInstall
OnAfterInstall
OnBeforeInstall