Installer.OnCommitting(IDictionary) 方法

定义

引发 Committing 事件。Raises the Committing event.

protected:
 virtual void OnCommitting(System::Collections::IDictionary ^ savedState);
protected virtual void OnCommitting (System.Collections.IDictionary savedState);
abstract member OnCommitting : System.Collections.IDictionary -> unit
override this.OnCommitting : System.Collections.IDictionary -> unit
Protected Overridable Sub OnCommitting (savedState As IDictionary)

参数

savedState
IDictionary

IDictionary,它包含提交 Installers 属性中的安装程序之前计算机的状态。An IDictionary that contains the state of the computer before the installers in the Installers property are committed.

示例

下面的示例演示OnCommittingInstaller类的方法。The following example demonstrates the OnCommitting method of the Installer class. OnCommitting方法在派生类中被重写。The OnCommitting method is overridden in the derived class. 为用户提供了空间, 以添加要在提交之前和提交之后执行的步骤。Space is provided for the user to add the steps to be performed before committing and after committing.

   // Override the 'OnCommitting' method.
protected:
   virtual void OnCommitting( IDictionary^ savedState ) override
   {
      Installer::OnCommitting( savedState );
      
      // Add steps to be done before committing an application.
      Console::WriteLine( "The OnCommitting method of MyInstaller called" );
   }
// Override the 'OnCommitting' method.
protected override void OnCommitting(IDictionary savedState)
{
   base.OnCommitting(savedState);
   // Add steps to be done before committing an application.
   Console.WriteLine("The OnCommitting method of MyInstaller called");
}
' Override the 'OnCommitting' method.
Protected Overrides Sub OnCommitting(savedState As IDictionary)
   MyBase.OnCommitting(savedState)
   ' Add steps to be done before committing an application.
   Console.WriteLine("The OnCommitting method of MyInstaller called")
End Sub

注解

此方法在InstallerCollection运行此实例Commit的安装程序的方法之前调用。This method is called before the Commit methods of the installers in this instance's InstallerCollection run.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息, 请参阅处理和引发事件For more information, see Handling and Raising Events.

OnCommitting方法允许派生类在不附加委托的情况下处理事件。The OnCommitting method allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

在派生类中重写 OnCommitting(IDictionary) 时,一定要调用基类的 OnCommitting(IDictionary) 方法,以便已注册的委托对事件进行接收。When overriding OnCommitting(IDictionary) in a derived class, be sure to call the base class's OnCommitting(IDictionary) method so that registered delegates receive the event.

适用于

另请参阅