|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Installer Classe
Assembly: System.Configuration.Install (em System.Configuration.Install. dll)
Inherit the Installer class. Override the Install, Commit, Rollback, and Uninstall methods. Add the RunInstallerAttribute to your derived class and set it to true. Colocar sua classe derivada no conjunto de módulos (assembly) com seu aplicativo para instalar. Chame os instaladores. Por exemplo, usar o InstallUtil.exe para invocar os instaladores.
using System; using System.Collections; using System.ComponentModel; using System.Configuration.Install; // Set 'RunInstaller' attribute to true. [RunInstaller(true)] public class MyInstallerClass: Installer { public MyInstallerClass() :base() { // Attach the 'Committed' event. this.Committed += new InstallEventHandler(MyInstaller_Committed); // Attach the 'Committing' event. this.Committing += new InstallEventHandler(MyInstaller_Committing); } // Event handler for 'Committing' event. private void MyInstaller_Committing(object sender, InstallEventArgs e) { Console.WriteLine(""); Console.WriteLine("Committing Event occured."); Console.WriteLine(""); } // Event handler for 'Committed' event. private void MyInstaller_Committed(object sender, InstallEventArgs e) { Console.WriteLine(""); Console.WriteLine("Committed Event occured."); Console.WriteLine(""); } // Override the 'Install' method. public override void Install(IDictionary savedState) { base.Install(savedState); } // Override the 'Commit' method. public override void Commit(IDictionary savedState) { base.Commit(savedState); } // Override the 'Rollback' method. public override void Rollback(IDictionary savedState) { base.Rollback(savedState); } public static void Main() { Console.WriteLine("Usage : installutil.exe Installer.exe "); } }
import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Configuration.Install.*;
// Set 'RunInstaller' attribute to true.
/** @attribute RunInstaller(true)
*/
public class MyInstallerClass extends Installer
{
public MyInstallerClass()
{
// Attach the 'Committed' event.
this.add_Committed(new InstallEventHandler(MyInstaller_Committed));
// Attach the 'Committing' event.
this.add_Committing(new InstallEventHandler(MyInstaller_Committing));
} //MyInstallerClass
// Event handler for 'Committing' event.
private void MyInstaller_Committing(Object sender, InstallEventArgs e)
{
Console.WriteLine("");
Console.WriteLine("Committing Event occured.");
Console.WriteLine("");
} //MyInstaller_Committing
// Event handler for 'Committed' event.
private void MyInstaller_Committed(Object sender, InstallEventArgs e)
{
Console.WriteLine("");
Console.WriteLine("Committed Event occured.");
Console.WriteLine("");
} //MyInstaller_Committed
// Override the 'Install' method.
public void Install(IDictionary savedState)
{
super.Install(savedState);
} //Install
// Override the 'Commit' method.
public void Commit(IDictionary savedState)
{
super.Commit(savedState);
} //Commit
// Override the 'Rollback' method.
public void Rollback(IDictionary savedState)
{
super.Rollback(savedState);
} //Rollback
public static void main(String[] args)
{
Console.WriteLine("Usage : installutil.exe Installer.exe ");
} //main
} //MyInstallerClass
System.MarshalByRefObject
System.ComponentModel.Component
System.Configuration.Install.Installer
System.Configuration.Install.AssemblyInstaller
System.Configuration.Install.ComponentInstaller
System.Configuration.Install.TransactedInstaller
System.Management.Instrumentation.DefaultManagementProjectInstaller
System.Management.Instrumentation.ManagementInstaller