In the previous section you have learned how to start and stop ACComponents via ACUrlCommand. You can do the same directly without ACUrlCommand.
1. Starting or instantiating components
The following methods (different signatures) are defined in the ACComponent class for this purpose:
public virtual IACComponent StartACComponent(
string acIdentifier,
object content,
object[] acParameter,
ACStartCompOptions startOptions = ACStartCompOptions.Default)
public virtual IACComponent StartACComponent(
ACClass acClass,
object content,
ACValueList parameterList,
Global.ACStartTypes startChildMode = Global.ACStartTypes.Automatic,
bool asProxy = false,
string acIdentifier = "")
public virtual IACComponent StartACComponent(
ACChildInstanceInfo instanceInfo,
Global.ACStartTypes startChildMode = Global.ACStartTypes.Automatic,
bool asProxy = false,
string acNameInstance = "")
In the parameter "acIdentifer" you pass the name of the child class/instance that was defined by the development environment in the application tree below the class you are currently in (this-Pointer). If no class with this ACIdentifier could be found in the application tree, the system checks whether it is a business object class (derived from ACBSO). If so, a new dynamic "child instance" is created below the instance in which they are currently located.
The parameter "object content" is passed to the second contructor parameter "IACObject content" during construction.
The parameter "object[] acParameter" must contain the parameters that are passed to the fourth constructor parameter as the "ACValueList parameter". You can do this in two different ways:
- object[] acParameter contains only one element of the type ACValueList which contains all required parameters according to ACClassConstructorInfo. To do this, call the method ACClass.TypeACSignature() of the corresponding iPlus type that you want to instantiate. This way you get the ACValueList filled with the necessary parameters which you then set as the only element in the acParameter array.
- object[] acParameter contains exactly the parameters that are required according to ACClassConstructorInfo. The StartACComponent method internally converts the array into an ACValueList.
2. Stopping or unloading components
The following methods (different signatures) are defined in the ACComponent class for this purpose:
public virtual bool Stop()
Method to stop yourself (this).
public bool StopACComponent(string acIdentifier, bool deleteACClassTask = false)
Method to stop a child component with an acIdentifier.
public bool StopACComponent(IACComponent acComponent, bool deleteACClassTask = false)
Method to stop the acComponent passed.