Condividi tramite


ComponentInstaller.CopyFromComponent(IComponent) Metodo

Definizione

Quando sottoposto a override in una classe derivata, copia tutte le proprietà richieste in fase di installazione dal componente specificato.

public:
 abstract void CopyFromComponent(System::ComponentModel::IComponent ^ component);
public abstract void CopyFromComponent (System.ComponentModel.IComponent component);
abstract member CopyFromComponent : System.ComponentModel.IComponent -> unit
Public MustOverride Sub CopyFromComponent (component As IComponent)

Parametri

component
IComponent

Il componente da cui copiare.

Esempio

Nell'esempio seguente viene definita una classe MyInstallClass, che crea il registro eventi e copia le proprietà del componente del registro eventi in EventLogInstaller. Verifica anche se l'oggetto ServiceInstaller può eseguire lo stesso tipo di installazione dell'oggetto EventLogInstaller.

EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller;
// Create a source for the specified event log, on local computer.
EventLog::CreateEventSource( "MyEventSource", "MyEventLog", "." );
// Create an event log instance and associate it with the log .
EventLog^ myEventLog = gcnew EventLog( "MyEventLog",".","MyEventSource" );
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller->CopyFromComponent( myEventLog );
EventLogInstaller myEventLogInstaller = new EventLogInstaller();
// Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource","MyEventLog", ".");
// Create an event log instance and associate it with the log .
EventLog myEventLog = new EventLog("MyEventLog", ".", "MyEventSource");
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog);
Dim myEventLogInstaller As New EventLogInstaller()
' Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource", "MyEventLog", ".")
' Create an event log instance and associate it with the log .
Dim myEventLog As New EventLog("MyEventLog", ".", "MyEventSource")
' Copy the properties that are required at install time from
' the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog)

Commenti

Il programma di installazione deve accettare tutte le informazioni che può essere ottenuto dal componente live e archiviarlo per l'uso in fase di installazione.

Si applica a