Installer.Commit(IDictionary) Metoda

Definicja

Po zastąpieniu w klasie pochodnej kończy transakcję instalacji.

public:
 virtual void Commit(System::Collections::IDictionary ^ savedState);
public virtual void Commit (System.Collections.IDictionary savedState);
abstract member Commit : System.Collections.IDictionary -> unit
override this.Commit : System.Collections.IDictionary -> unit
Public Overridable Sub Commit (savedState As IDictionary)

Parametry

savedState
IDictionary

Element IDictionary zawierający stan komputera po uruchomieniu wszystkich instalatorów w kolekcji.

Wyjątki

Parametr savedState to null.

-lub-

Zapisany stan IDictionary mógł zostać uszkodzony.

Wystąpił wyjątek podczas Commit(IDictionary) fazy instalacji. Ten wyjątek jest ignorowany, a instalacja będzie kontynuowana. Jednak aplikacja może nie działać poprawnie po zakończeniu instalacji.

Przykłady

W poniższym przykładzie pokazano metodę CommitInstaller klasy . Klasa pochodzi z klasy bazowej Installer , a Commit metoda jest zastępowana.

// Override the 'Commit' method of the Installer class.
virtual void Commit( IDictionary^ mySavedState ) override
{
   Installer::Commit( mySavedState );
   Console::WriteLine( "The Commit method of 'MyInstallerSample' "
      "has been called" );
}
// Override the 'Commit' method of the Installer class.
public override void Commit( IDictionary mySavedState )
{
   base.Commit( mySavedState );
   Console.WriteLine( "The Commit method of 'MyInstallerSample'"
                     + "has been called" );
}
' Override the 'Commit' method of the Installer class.
Public Overrides Sub Commit(mySavedState As IDictionary)
   MyBase.Commit(mySavedState)
   Console.WriteLine("The Commit method of 'MyInstallerSample'" + _
                                                "has been called")
End Sub

Uwagi dotyczące dziedziczenia

Jeśli zastąpisz metodę Commit(IDictionary) w klasie pochodnej, najpierw wywołaj metodę klasy Commit(IDictionary) bazowej w metodzie pochodnej. Metoda Commit(IDictionary) jest wywoływana tylko wtedy, gdy Install(IDictionary) metoda każdego instalatora w tym wystąpieniu InstallerCollection powiedzie się. Metoda Commit(IDictionary) przechowuje informacje potrzebne do poprawnego odinstalowania i wywołuje Commit(IDictionary) metodę każdego instalatora w kolekcji.

Dotyczy

Zobacz też