InstallEventArgs 생성자

정의

InstallEventArgs 클래스의 새 인스턴스를 초기화합니다.

오버로드

InstallEventArgs()

InstallEventArgs 클래스의 새 인스턴스를 초기화하고, SavedState 속성을 비워둡니다.

InstallEventArgs(IDictionary)

InstallEventArgs 클래스의 새 인스턴스를 초기화하고, SavedState에 대한 값을 지정합니다.

InstallEventArgs()

InstallEventArgs 클래스의 새 인스턴스를 초기화하고, SavedState 속성을 비워둡니다.

public:
 InstallEventArgs();
public InstallEventArgs ();
Public Sub New ()

예제

다음 예제는 InstallEventArgs 생성자 및 SavedState 의 속성을 InstallEventArgs 클래스.

호출 하는 두 개의 새 이벤트가 BeforeCommitAfterCommit입니다. 이러한 이벤트의 처리기 라는 보호 되는 메서드에서 호출 됩니다 OnBeforeCommitOnAfterCommit 각각. 이러한 이벤트가 발생 하는 경우는 Commit 메서드가 호출 됩니다.

#using <System.dll>
#using <System.Configuration.Install.dll>

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Configuration::Install;
using namespace System::IO;

[RunInstaller(true)]
ref class MyInstaller: public Installer
{
public:
   // Simple events to handle before and after commit handlers.
   event InstallEventHandler^ BeforeCommit;
   event InstallEventHandler^ AfterCommit;

   MyInstaller()
   {
      // Add handlers to the events.
      BeforeCommit += gcnew InstallEventHandler( this, &MyInstaller::BeforeCommitHandler );
      AfterCommit += gcnew InstallEventHandler( this, &MyInstaller::AfterCommitHandler );
   }

   virtual void Install( IDictionary^ savedState ) override
   {
      Installer::Install( savedState );
      Console::WriteLine( "Install ...\n" );
   }

   virtual void Commit( IDictionary^ savedState ) override
   {
      Console::WriteLine( "Before Committing ...\n" );
      // Call the 'OnBeforeCommit' protected method.
      OnBeforeCommit( savedState );
      Installer::Commit( savedState );
      Console::WriteLine( "Committing ...\n" );
      // Call the 'OnAfterCommit' protected method.
      OnAfterCommit( savedState );
      Console::WriteLine( "After Committing ...\n" );
   }

   virtual void Rollback( IDictionary^ savedState ) override
   {
      Installer::Rollback( savedState );
      Console::WriteLine( "RollBack ...\n" );
   }

   virtual void Uninstall( IDictionary^ savedState ) override
   {
      Installer::Uninstall( savedState );
      Console::WriteLine( "UnInstall ...\n" );
   }

   // Protected method that invoke the handlers associated with the 'BeforeCommit' event.
protected:
   virtual void OnBeforeCommit( IDictionary^ savedState )
   {
      BeforeCommit( this, gcnew InstallEventArgs( savedState ) );
   }

   // Protected method that invoke the handlers associated with the 'AfterCommit' event.
protected:
   virtual void OnAfterCommit( IDictionary^ savedState )
   {
      AfterCommit( this, gcnew InstallEventArgs );
   }

   // A simple event handler to exemplify the example.
   void BeforeCommitHandler( Object^ sender, InstallEventArgs^ e )
   {
      Console::WriteLine( "BeforeCommitHandler event handler has been called\n" );
      Console::WriteLine( "The count of saved state objects are : {0}\n",
         e->SavedState->Count );
   }

   // A simple event handler to exemplify the example.
private:
   void AfterCommitHandler( Object^ sender, InstallEventArgs^ e )
   {
      Console::WriteLine( "AfterCommitHandler event handler has been called\n" );
   }
};

using System;
using System.ComponentModel;
using System.Collections;
using System.Configuration.Install;
using System.IO;

[RunInstaller(true)]
public class MyInstaller : Installer
{
   // Simple events to handle before and after commit handlers.
   public event InstallEventHandler BeforeCommit;
   public event InstallEventHandler AfterCommit;

   public MyInstaller()
   {
      // Add handlers to the events.
      BeforeCommit += new InstallEventHandler(BeforeCommitHandler);
      AfterCommit += new InstallEventHandler(AfterCommitHandler);
   }

   public override void Install(IDictionary savedState)
   {
      base.Install(savedState);
      Console.WriteLine("Install ...\n");
   }

   public override void Commit(IDictionary savedState)
   {
      Console.WriteLine("Before Committing ...\n");
      // Call the 'OnBeforeCommit' protected method.
      OnBeforeCommit(savedState);
      base.Commit(savedState);
      Console.WriteLine("Committing ...\n");
      // Call the 'OnAfterCommit' protected method.
      OnAfterCommit(savedState);
      Console.WriteLine("After Committing ...\n");
   }

   public override void Rollback(IDictionary savedState)
   {
      base.Rollback(savedState);
      Console.WriteLine("RollBack ...\n");
   }

   public override void Uninstall(IDictionary savedState)
   {
      base.Uninstall(savedState);
      Console.WriteLine("UnInstall ...\n");
   }

   // Protected method that invoke the handlers associated with the 'BeforeCommit' event.
   protected virtual void OnBeforeCommit(IDictionary savedState)
   {
      if(BeforeCommit != null)
         BeforeCommit(this, new InstallEventArgs(savedState));
   }

   // Protected method that invoke the handlers associated with the 'AfterCommit' event.
   protected virtual void OnAfterCommit(IDictionary savedState)
   {
      if(AfterCommit != null)
         AfterCommit(this, new InstallEventArgs());
   }

   // A simple event handler to exemplify the example.
   private void BeforeCommitHandler(Object sender, InstallEventArgs e)
   {
      Console.WriteLine("BeforeCommitHandler event handler has been called\n");
      Console.WriteLine("The count of saved state objects are : {0}\n",
         e.SavedState.Count);
   }

   // A simple event handler to exemplify the example.
   private void AfterCommitHandler(Object sender, InstallEventArgs e)
   {
      Console.WriteLine("AfterCommitHandler event handler has been called\n");
   }
}
Imports System.ComponentModel
Imports System.Collections
Imports System.Configuration.Install
Imports System.IO

<RunInstaller(True)> Public Class MyInstaller
   Inherits Installer
   ' Simple events to handle before and after commit handlers.
   Public Event BeforeCommit As InstallEventHandler
   Public Event AfterCommit As InstallEventHandler

   Public Sub New()
      ' Add handlers to the events.
      AddHandler BeforeCommit, AddressOf BeforeCommitHandler
      AddHandler AfterCommit, AddressOf AfterCommitHandler
   End Sub

   Public Overrides Sub Install(savedState As IDictionary)
      MyBase.Install(savedState)
      Console.WriteLine("Install ..." + ControlChars.Newline)
   End Sub

   Public Overrides Sub Commit(savedState As IDictionary)
      Console.WriteLine("Before Committing ..." + ControlChars.Newline)
      ' Call the 'OnBeforeCommit' protected method.
      OnBeforeCommit(savedState)
      MyBase.Commit(savedState)
      Console.WriteLine("Committing ..." + ControlChars.Newline)
      ' Call the 'OnAfterCommit' protected method.
      OnAfterCommit(savedState)
      Console.WriteLine("After Committing ..." + ControlChars.Newline)
   End Sub

   Public Overrides Sub Rollback(savedState As IDictionary)
      MyBase.Rollback(savedState)
      Console.WriteLine("RollBack ..." + ControlChars.Newline)
   End Sub

   Public Overrides Sub Uninstall(savedState As IDictionary)
      MyBase.Uninstall(savedState)
      Console.WriteLine("UnInstall ..." + ControlChars.Newline)
   End Sub

   ' Protected method that invoke the handlers associated with the 'BeforeCommit' event.
   Protected Overridable Sub OnBeforeCommit(savedState As IDictionary)
         RaiseEvent BeforeCommit(Me, New InstallEventArgs(savedState))
   End Sub

   ' Protected method that invoke the handlers associated with the 'AfterCommit' event.
   Protected Overridable Sub OnAfterCommit(savedState As IDictionary)
         RaiseEvent AfterCommit(Me, New InstallEventArgs())
   End Sub

   ' A simple event handler to exemplify the example.
   Private Sub BeforeCommitHandler(sender As Object, e As InstallEventArgs)
      Console.WriteLine("BeforeCommitHandler event handler has been called" + _
                                                      ControlChars.Newline)
      Console.WriteLine("The count of saved state objects are : {0}" + _
                                    ControlChars.Newline, e.SavedState.Count)
   End Sub

   ' A simple event handler to exemplify the example.
   Private Sub AfterCommitHandler(sender As Object, e As InstallEventArgs)
      Console.WriteLine("AfterCommitHandler event handler has been called" + _
                                                      ControlChars.Newline)
   End Sub
End Class

추가 정보

적용 대상

InstallEventArgs(IDictionary)

InstallEventArgs 클래스의 새 인스턴스를 초기화하고, SavedState에 대한 값을 지정합니다.

public:
 InstallEventArgs(System::Collections::IDictionary ^ savedState);
public InstallEventArgs (System.Collections.IDictionary savedState);
new System.Configuration.Install.InstallEventArgs : System.Collections.IDictionary -> System.Configuration.Install.InstallEventArgs
Public Sub New (savedState As IDictionary)

매개 변수

savedState
IDictionary

설치의 현재 상태를 나타내는 IDictionary입니다.

예제

다음 예제는 InstallEventArgs 생성자 및 SavedState 의 속성을 InstallEventArgs 클래스.

호출 하는 두 개의 새 이벤트가 BeforeCommitAfterCommit입니다. 이러한 이벤트의 처리기 라는 보호 되는 메서드에서 호출 됩니다 OnBeforeCommitOnAfterCommit 각각. 이러한 이벤트가 발생 하는 경우는 Commit 메서드가 호출 됩니다.

#using <System.dll>
#using <System.Configuration.Install.dll>

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Configuration::Install;
using namespace System::IO;

[RunInstaller(true)]
ref class MyInstaller: public Installer
{
public:
   // Simple events to handle before and after commit handlers.
   event InstallEventHandler^ BeforeCommit;
   event InstallEventHandler^ AfterCommit;

   MyInstaller()
   {
      // Add handlers to the events.
      BeforeCommit += gcnew InstallEventHandler( this, &MyInstaller::BeforeCommitHandler );
      AfterCommit += gcnew InstallEventHandler( this, &MyInstaller::AfterCommitHandler );
   }

   virtual void Install( IDictionary^ savedState ) override
   {
      Installer::Install( savedState );
      Console::WriteLine( "Install ...\n" );
   }

   virtual void Commit( IDictionary^ savedState ) override
   {
      Console::WriteLine( "Before Committing ...\n" );
      // Call the 'OnBeforeCommit' protected method.
      OnBeforeCommit( savedState );
      Installer::Commit( savedState );
      Console::WriteLine( "Committing ...\n" );
      // Call the 'OnAfterCommit' protected method.
      OnAfterCommit( savedState );
      Console::WriteLine( "After Committing ...\n" );
   }

   virtual void Rollback( IDictionary^ savedState ) override
   {
      Installer::Rollback( savedState );
      Console::WriteLine( "RollBack ...\n" );
   }

   virtual void Uninstall( IDictionary^ savedState ) override
   {
      Installer::Uninstall( savedState );
      Console::WriteLine( "UnInstall ...\n" );
   }

   // Protected method that invoke the handlers associated with the 'BeforeCommit' event.
protected:
   virtual void OnBeforeCommit( IDictionary^ savedState )
   {
      BeforeCommit( this, gcnew InstallEventArgs( savedState ) );
   }

   // Protected method that invoke the handlers associated with the 'AfterCommit' event.
protected:
   virtual void OnAfterCommit( IDictionary^ savedState )
   {
      AfterCommit( this, gcnew InstallEventArgs );
   }

   // A simple event handler to exemplify the example.
   void BeforeCommitHandler( Object^ sender, InstallEventArgs^ e )
   {
      Console::WriteLine( "BeforeCommitHandler event handler has been called\n" );
      Console::WriteLine( "The count of saved state objects are : {0}\n",
         e->SavedState->Count );
   }

   // A simple event handler to exemplify the example.
private:
   void AfterCommitHandler( Object^ sender, InstallEventArgs^ e )
   {
      Console::WriteLine( "AfterCommitHandler event handler has been called\n" );
   }
};

using System;
using System.ComponentModel;
using System.Collections;
using System.Configuration.Install;
using System.IO;

[RunInstaller(true)]
public class MyInstaller : Installer
{
   // Simple events to handle before and after commit handlers.
   public event InstallEventHandler BeforeCommit;
   public event InstallEventHandler AfterCommit;

   public MyInstaller()
   {
      // Add handlers to the events.
      BeforeCommit += new InstallEventHandler(BeforeCommitHandler);
      AfterCommit += new InstallEventHandler(AfterCommitHandler);
   }

   public override void Install(IDictionary savedState)
   {
      base.Install(savedState);
      Console.WriteLine("Install ...\n");
   }

   public override void Commit(IDictionary savedState)
   {
      Console.WriteLine("Before Committing ...\n");
      // Call the 'OnBeforeCommit' protected method.
      OnBeforeCommit(savedState);
      base.Commit(savedState);
      Console.WriteLine("Committing ...\n");
      // Call the 'OnAfterCommit' protected method.
      OnAfterCommit(savedState);
      Console.WriteLine("After Committing ...\n");
   }

   public override void Rollback(IDictionary savedState)
   {
      base.Rollback(savedState);
      Console.WriteLine("RollBack ...\n");
   }

   public override void Uninstall(IDictionary savedState)
   {
      base.Uninstall(savedState);
      Console.WriteLine("UnInstall ...\n");
   }

   // Protected method that invoke the handlers associated with the 'BeforeCommit' event.
   protected virtual void OnBeforeCommit(IDictionary savedState)
   {
      if(BeforeCommit != null)
         BeforeCommit(this, new InstallEventArgs(savedState));
   }

   // Protected method that invoke the handlers associated with the 'AfterCommit' event.
   protected virtual void OnAfterCommit(IDictionary savedState)
   {
      if(AfterCommit != null)
         AfterCommit(this, new InstallEventArgs());
   }

   // A simple event handler to exemplify the example.
   private void BeforeCommitHandler(Object sender, InstallEventArgs e)
   {
      Console.WriteLine("BeforeCommitHandler event handler has been called\n");
      Console.WriteLine("The count of saved state objects are : {0}\n",
         e.SavedState.Count);
   }

   // A simple event handler to exemplify the example.
   private void AfterCommitHandler(Object sender, InstallEventArgs e)
   {
      Console.WriteLine("AfterCommitHandler event handler has been called\n");
   }
}
Imports System.ComponentModel
Imports System.Collections
Imports System.Configuration.Install
Imports System.IO

<RunInstaller(True)> Public Class MyInstaller
   Inherits Installer
   ' Simple events to handle before and after commit handlers.
   Public Event BeforeCommit As InstallEventHandler
   Public Event AfterCommit As InstallEventHandler

   Public Sub New()
      ' Add handlers to the events.
      AddHandler BeforeCommit, AddressOf BeforeCommitHandler
      AddHandler AfterCommit, AddressOf AfterCommitHandler
   End Sub

   Public Overrides Sub Install(savedState As IDictionary)
      MyBase.Install(savedState)
      Console.WriteLine("Install ..." + ControlChars.Newline)
   End Sub

   Public Overrides Sub Commit(savedState As IDictionary)
      Console.WriteLine("Before Committing ..." + ControlChars.Newline)
      ' Call the 'OnBeforeCommit' protected method.
      OnBeforeCommit(savedState)
      MyBase.Commit(savedState)
      Console.WriteLine("Committing ..." + ControlChars.Newline)
      ' Call the 'OnAfterCommit' protected method.
      OnAfterCommit(savedState)
      Console.WriteLine("After Committing ..." + ControlChars.Newline)
   End Sub

   Public Overrides Sub Rollback(savedState As IDictionary)
      MyBase.Rollback(savedState)
      Console.WriteLine("RollBack ..." + ControlChars.Newline)
   End Sub

   Public Overrides Sub Uninstall(savedState As IDictionary)
      MyBase.Uninstall(savedState)
      Console.WriteLine("UnInstall ..." + ControlChars.Newline)
   End Sub

   ' Protected method that invoke the handlers associated with the 'BeforeCommit' event.
   Protected Overridable Sub OnBeforeCommit(savedState As IDictionary)
         RaiseEvent BeforeCommit(Me, New InstallEventArgs(savedState))
   End Sub

   ' Protected method that invoke the handlers associated with the 'AfterCommit' event.
   Protected Overridable Sub OnAfterCommit(savedState As IDictionary)
         RaiseEvent AfterCommit(Me, New InstallEventArgs())
   End Sub

   ' A simple event handler to exemplify the example.
   Private Sub BeforeCommitHandler(sender As Object, e As InstallEventArgs)
      Console.WriteLine("BeforeCommitHandler event handler has been called" + _
                                                      ControlChars.Newline)
      Console.WriteLine("The count of saved state objects are : {0}" + _
                                    ControlChars.Newline, e.SavedState.Count)
   End Sub

   ' A simple event handler to exemplify the example.
   Private Sub AfterCommitHandler(sender As Object, e As InstallEventArgs)
      Console.WriteLine("AfterCommitHandler event handler has been called" + _
                                                      ControlChars.Newline)
   End Sub
End Class

추가 정보

적용 대상