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

Installers プロパティ内のインストーラーがインストールされる前のコンピューターの状態を格納する IDictionary。 この 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) メソッドを呼び出してください。

適用対象

こちらもご覧ください