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

注釈

このメソッドは、このインスタンスのInstallerCollectionのインストーラーのInstall メソッドが呼び出される前に呼び出されます。

イベントを発生させると、デリゲートを介してイベント ハンドラーが呼び出されます。 詳細については、「イベントの 処理と発生」を参照してください。

OnBeforeInstall メソッドを使用すると、派生クラスはデリゲートをアタッチせずにイベントを処理できます。 これは、派生クラスでイベントを処理するために推奨される手法です。

注意 (継承者)

派生クラスで OnBeforeInstall(IDictionary) をオーバーライドする場合は、登録されているデリゲートがイベントを受け取るように、基底クラスの OnBeforeInstall(IDictionary) メソッドを必ず呼び出してください。

適用対象

こちらもご覧ください