Click or drag to resize

ObjectWithExternalInterfaceAddInterfaceClassReference(IObjectWithExternalInterface, InterfaceFamilyType, Boolean, Boolean, String) Method

Adds an InterfaceClass reference to this ObjectWithExternalInterface using the provided InterfaceClass object. The InterfaceClass reference is added as a ExternalInterfaceType object.

Namespace: Aml.Engine.CAEX.Extensions
Assembly: Aml.Engine (in Aml.Engine.dll) Version: 3.2
Syntax
public static ExternalInterfaceType AddInterfaceClassReference(
	this IObjectWithExternalInterface ObjectWithExternalInterface,
	InterfaceFamilyType interfaceClass,
	bool addUnique = true,
	bool addInstance = false,
	string name = ""
)

Parameters

ObjectWithExternalInterface  IObjectWithExternalInterface
the CAEX object with external interfaces
interfaceClass  InterfaceFamilyType
The InterfaceClass to be assigned to the ObjectWithExternalInterface.
addUnique  Boolean  (Optional)
if set to true, the InterfaceClass reference is not added, if a reference to the provided InterfaceClass already exists.
addInstance  Boolean  (Optional)
if set to true, the reference is created as am instance of the InterfaceClass, containing all ExternalInterfaces and Attributes of the InterfaceClass.
name  String  (Optional)
Provides the name for the new external interface. If no name is given, the name is taken from the referenced class.

Return Value

ExternalInterfaceType
The new added InterfaceClass reference.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IObjectWithExternalInterface. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptioninterfaceClass
Remarks
The default behaviour is, that only a reference to the interface class is added and no instance of the class containing all Attributes and ExternalInterface objects. If an instance is required, set the optional parameter 'addInstance' to true or use the CreateClassInstance and the CAEXSequenceOfCAEXObjects Insert(CAEXWrapper, bool) methods.
Example
This sample shows how to call the AddInterfaceClassReference(IObjectWithExternalInterface, InterfaceFamilyType, Boolean, Boolean, String) method using a standard base InterfaceClass from the InterfaceClassLib(CAEXDocument)
C#
var amlInterfaceClassLib = AutomationMLInterfaceClassLibType.InterfaceClassLib (myDocument);
var myIH = myDocument.CAEXFile.InstanceHierarchy.Append ("myIH");
var myIE = myIH.InternalElement.Append("myIH");
myIE.AddInterfaceClassReference (amlInterfaceClassLib.AutomationMLBaseInterface);
See Also