語言

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) ,讓註冊代理接收事件。

適用於

另請參閱