Επεξεργασία

Κοινή χρήση μέσω


Installer.Commit(IDictionary) Method

Definition

When overridden in a derived class, completes the install transaction.

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)

Parameters

savedState
IDictionary

An IDictionary that contains the state of the computer after all the installers in the collection have run.

Exceptions

The savedState parameter is null.

-or-

The saved-state IDictionary might have been corrupted.

An exception occurred during the Commit(IDictionary) phase of the installation. This exception is ignored and the installation continues. However, the application might not function correctly after the installation is complete.

Examples

The following example demonstrates the Commit method of the Installer class. A class is derived from the Installer base class and the Commit method are overridden.

// 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

Notes to Inheritors

If you override the Commit(IDictionary) method in a derived class, be sure to call the base class's Commit(IDictionary) method first in your derived method. The Commit(IDictionary) method is called only if the Install(IDictionary) method of each installer in this instance's InstallerCollection succeeds. The Commit(IDictionary) method stores information needed to do a correct uninstallation, and calls the Commit(IDictionary) method of each installer in the collection.

Applies to

See also