override public void Initialize() { ICapeUtilitiesCOM p_Util = ((ICapeUtilitiesCOM)this.p_Unit); p_Util.Initialize(); ICapeIdentification p_Id = (ICapeIdentification)p_Unit; //wrap ports... ICapeCollection portColl = (ICapeCollection)((ICapeUnitCOM)(p_Unit)).ports; int portCount = portColl.Count(); object[] portConnections = new object[portCount]; for (int i = 0; i < portCount; i++) { ICapeUnitPortCOM port = (ICapeUnitPortCOM)portColl.Item(i + 1); this.Ports.Add(new UnitPortWrapper(port)); } //wrap parameters... ICapeCollection paramColl = (ICapeCollection)((ICapeUtilitiesCOM)(p_Unit)).parameters; int paramCount = paramColl.Count(); for (int i = 0; i < paramCount; i++) { ICapeParameter param = (ICapeParameter)paramColl.Item(i + 1); CapeParamType paramType = ((ICapeParameterSpecCOM)param.Specification).Type; if (((ICapeParameterSpecCOM)param.Specification).Type == CapeParamType.CAPE_REAL) { this.Parameters.Add(new RealParameterWrapper(param)); } if (((ICapeParameterSpecCOM)param.Specification).Type == CapeParamType.CAPE_INT) { this.Parameters.Add(new IntegerParameterWrapper(param)); } if (((ICapeParameterSpecCOM)param.Specification).Type == CapeParamType.CAPE_OPTION) { this.Parameters.Add(new OptionParameterWrapper(param)); } if (((ICapeParameterSpecCOM)param.Specification).Type == CapeParamType.CAPE_BOOLEAN) { this.Parameters.Add(new BooleanParameterWrapper(param)); } if (((ICapeParameterSpecCOM)param.Specification).Type == CapeParamType.CAPE_ARRAY) { this.Parameters.Add(new ArrayParameterWrapper(param)); } } }
/// <summary> /// Initializes a new instance of the <see cref="UnitPort"/> class. /// </summary> /// <param name="port"><see cref="ICapeUnitPort"/>ICapeUnitPortof .</param> public UnitPortWrapper(ICapeUnitPortCOM port) : base(((ICapeIdentification)port).ComponentName, ((ICapeIdentification)port).ComponentDescription, ((ICapeUnitPortCOM)port).direction, ((ICapeUnitPortCOM)port).portType) { m_Port = port; }