Installer.OnBeforeInstall(IDictionary) Metoda

Definicja

BeforeInstall Zgłasza zdarzenie.

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)

Parametry

savedState
IDictionary

Element IDictionary zawierający stan komputera przed zainstalowaniem Installers instalatorów we właściwości . Ten IDictionary obiekt powinien być pusty w tym momencie.

Przykłady

W poniższym przykładzie pokazano metodę OnBeforeInstall . Ta metoda jest zastępowana w klasie pochodnej. Dostępne jest miejsce, aby dodać kroki do wykonania przed instalacją w metodzie 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

Uwagi

Ta metoda jest wywoływana przed Install wywołaniami metod instalatorów w tym wystąpieniu InstallerCollection .

Podnoszenie zdarzenia wywołuje program obsługi zdarzeń przez delegata. Aby uzyskać więcej informacji, zobacz Obsługa i podnoszenie zdarzeń.

Metoda OnBeforeInstall umożliwia klasom pochodnym obsługę zdarzenia bez dołączania delegata. Jest to preferowana technika obsługi zdarzenia w klasie pochodnej.

Uwagi dotyczące dziedziczenia

Podczas zastępowania OnBeforeInstall(IDictionary) w klasie pochodnej należy wywołać metodę klasy OnBeforeInstall(IDictionary) bazowej, aby zarejestrowani delegaci odbierali zdarzenie.

Dotyczy

Zobacz też