Installer.Uninstall(IDictionary) Método

Definição

Quando substituído em uma classe derivada, remove uma instalação.When overridden in a derived class, removes an installation.

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

Parâmetros

savedState
IDictionary

Um IDictionary que contém o estado do computador após a conclusão da instalação.An IDictionary that contains the state of the computer after the installation was complete.

Exceções

O IDictionary de estado salvo pode estar corrompido.The saved-state IDictionary might have been corrupted.

Ocorreu uma exceção durante a desinstalação.An exception occurred while uninstalling. Essa exceção é ignorada e a desinstalação continua.This exception is ignored and the uninstall continues. No entanto, o aplicativo pode não estar totalmente desinstalado após a conclusão da desinstalação.However, the application might not be fully uninstalled after the uninstallation completes.

Exemplos

O exemplo a seguir demonstra Uninstall o método Installerde.The following example demonstrates the Uninstall method of Installer. O Uninstall método é substituído na classe derivada de Installer.The Uninstall method is overridden in the derived class of Installer.

   // Override 'Uninstall' method of Installer class.
public:
   virtual void Uninstall( IDictionary^ mySavedState ) override
   {
      if ( mySavedState == nullptr )
      {
         Console::WriteLine( "Uninstallation Error !" );
      }
      else
      {
         Installer::Uninstall( mySavedState );
         Console::WriteLine( "The Uninstall method of 'MyInstallerSample' has been called" );
      }
   }
// Override 'Uninstall' method of Installer class.
public override void Uninstall( IDictionary mySavedState )
{  
   if (mySavedState == null)
   {
      Console.WriteLine("Uninstallation Error !");
   }
   else
   {
      base.Uninstall( mySavedState );
      Console.WriteLine( "The Uninstall method of 'MyInstallerSample' has been called" );
   }
}
' Override 'Uninstall' method of Installer class.
Public Overrides Sub Uninstall(mySavedState As IDictionary)
   If mySavedState Is Nothing Then
      Console.WriteLine("Uninstallation Error !")
   Else
      MyBase.Uninstall(mySavedState)
      Console.WriteLine("The Uninstall method of 'MyInstallerSample' has been called")
   End If
End Sub

Notas aos Herdeiros

-Se você substituir o Install(IDictionary) método em uma classe derivada, certifique-se de chamar primeiro o método Install(IDictionary) da classe base em seu método derivado.- If you override the Install(IDictionary) method in a derived class, be sure to call the base class's Install(IDictionary) method first in your derived method. O Install(IDictionary) método chama o Install(IDictionary) método de Installers cada instalador contido na propriedade dessa instância.The Install(IDictionary) method calls the Install(IDictionary) method of each installer contained in the Installers property of this instance. Depois que os instaladores contidos forem executados, esse método IDictionary atualizará o objeto ( stateSaver especificado por meio do parâmetro) para refletir o status da instalação.After the contained installers run, this method updates the IDictionary object (specified through the stateSaver parameter) to reflect the status of the installation. O IDictionary deve estar vazio quando passado para o Install(IDictionary) método.The IDictionary should be empty when passed to the Install(IDictionary) method. Se todos Install(IDictionary) os métodos forem bem-sucedidos, Commit(IDictionary) o método será chamado.If all the Install(IDictionary) methods succeed, the Commit(IDictionary) method is called. Caso contrário, Rollback(IDictionary) o método será chamado.Otherwise, the Rollback(IDictionary) method is called.

-Se você precisar adicionar instâncias do instalador à Installers coleção Install(IDictionary) no método, certifique-se de executar as mesmas adições Uninstall(IDictionary) à coleção no método.- If you need to add installer instances to the Installers collection in the Install(IDictionary) method, be sure to perform the same additions to the collection in the Uninstall(IDictionary) method. No entanto, você pode evitar manter a coleção em ambos os métodos se adicionar instâncias do Installers instalador à coleção no construtor de classe do instalador personalizado.However, you can avoid maintaining the collection in both methods if you add installer instances to the Installers collection in the class constructor for your custom installer.

Aplica-se a

Veja também