Exemple #1
0
 public CapeOpenUnitParameter GetParameterByName(string name)
 {
     for (int i = 0; i < List.Count; i++)
     {
         CapeOpenUnitParameter zParam = (CapeOpenUnitParameter)List[i];
         if (zParam.Name == name)
         {
             return((CapeOpenUnitParameter)List[i]);
         }
     }
     ATCOError                   = new CapeOpenError();
     ATCOError.UserCode          = (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR;
     ATCOError.UserInterfaceName = "ICapeUnitCollection_Item";
     ATCOError.UserOperation     = "Item";
     ATCOError.UserDescription   = "The input value is a string but not rapresents a valid portname";
     throw new COMException("Errore", (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR);
 }
Exemple #2
0
        protected override object OnItem(object id)
        {
            //LogClass.WriteLog("On Item di Parameter: Count:" + List.Count.ToString());
            Int16 indice16;
            int   indice32;

            if (!(id is int) && !(id is string) && !(id is Int16))
            {
                ATCOError                   = new CapeOpenError();
                ATCOError.UserCode          = (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR;
                ATCOError.UserInterfaceName = "ICapeUnitCollection_Item";
                ATCOError.UserOperation     = "Item";
                ATCOError.UserDescription   = "The input value is not a valid number or string";
                throw (new COMException("Errore", (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR));
            }
            else
            {
                if (id is string)
                {
                    string str;
                    str = (string)id;
                    for (int i = 0; i < List.Count; i++)
                    {
                        CapeOpenUnitParameter zParameter = (CapeOpenUnitParameter)List[i];
                        if (zParameter.Name == str)
                        {
                            return(List[i]);
                        }
                    }
                    ATCOError                   = new CapeOpenError();
                    ATCOError.UserCode          = (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR;
                    ATCOError.UserInterfaceName = "ICapeUnitCollection_Item";
                    ATCOError.UserOperation     = "Item";
                    ATCOError.UserDescription   = "The input value is a string but not rapresents a valid portname";
                    throw new COMException("Errore", (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR);
                }
                else
                {//int or int16
                    try
                    {
                        if (id is int)
                        {
                            indice32 = (int)id;
                            return(List[indice32 - 1]);
                        }
                        if (id is Int16)
                        {
                            indice16 = (Int16)id;
                            return(List[indice16 - 1]);
                        }
                        return(null);
                    }
                    catch
                    {
                        ATCOError                   = new CapeOpenError();
                        ATCOError.UserCode          = (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR;
                        ATCOError.UserInterfaceName = "ICapeUnitCollection_Item";
                        ATCOError.UserOperation     = "Item";
                        ATCOError.UserDescription   = "The input value is a integer but is out of index";
                        throw (new COMException("Errore", (int)CAPEOPEN093.eCapeErrorInterfaceHR_tag.ECapeInvalidArgumentHR));
                    }
                }
            }
        }
Exemple #3
0
 public void Add(CapeOpenUnitParameter parameter)
 {
     List.Add(parameter);
 }