Installer.Commit(IDictionary) 方法

定义

在派生类中重写时,完成安装事务。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)

参数

savedState
IDictionary

IDictionary,它包含在集合中所有安装程序都运行后的计算机的状态。An IDictionary that contains the state of the computer after all the installers in the collection have run.

异常

savedState 参数为 nullThe savedState parameter is null.

-or- 保存的状态 IDictionary 可能已损坏。The saved-state IDictionary might have been corrupted.

在安装的 Commit(IDictionary) 阶段发生异常。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.

示例

下面的示例演示CommitInstaller类的方法。The following example demonstrates the Commit method of the Installer class. 类派生自Installer基类Commit , 方法被重写。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

继承者说明

如果在派生类Commit(IDictionary)中重写方法, 请确保先在派生方法中调用基类Commit(IDictionary)的方法。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. 仅当此实例中的每个InstallerCollection安装程序的Commit(IDictionary) 方法成功时,才Install(IDictionary)会调用方法。The Commit(IDictionary) method is called only if the Install(IDictionary) method of each installer in this instance's InstallerCollection succeeds. 方法存储执行正确卸载所需的信息, 并Commit(IDictionary)调用集合中每个安装程序的方法。 Commit(IDictionary)The Commit(IDictionary) method stores information needed to do a correct uninstallation, and calls the Commit(IDictionary) method of each installer in the collection.

适用于

另请参阅