예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="iCICInstance"></param>
        /// <param name="propName"></param>
        /// <returns></returns>
        public object GetProperty(ICaisisInputControl iCICInstance, string propName)
        {
            CaisisDynamicPropertyModifier cfh = GetFieldHelper(propName);

            if (cfh != null)
            {
                return(cfh.GetFieldValue(iCICInstance));
            }
            else
            {
                throw new Exception();
            }
        }
예제 #2
0
 public CaisisDynamicControlModifier(Type iCICType)
 {
     if (iCICType.GetInterface(typeof(ICaisisInputControl).Name) != null)
     {
         this.modifierType       = iCICType;
         this.controlConstructor = CreateConstructorDelegate(iCICType);
         IEnumerable <PropertyInfo> propList = EnumerateTypeMemberHierarchy(iCICType);
         foreach (PropertyInfo prop in propList)
         {
             CaisisMetaDataField cicMetaProp = Attribute.GetCustomAttribute(prop, typeof(CaisisMetaDataField), true) as CaisisMetaDataField;
             string propKey = prop.Name;
             if (cicMetaProp != null && !controlGetterSetters.ContainsKey(propKey))
             {
                 CaisisDynamicPropertyModifier cfh = new CaisisDynamicPropertyModifier(iCICType, propKey);
                 controlGetterSetters.Add(propKey, cfh);
             }
         }
     }
     else
     {
         string err = "Unable to create {0}, Type '{1}' must implement interface {2} and be marked with Attribute [{3}].";
         throw new Exception(string.Format(err, this.GetType().Name, iCICType.Name, ReflectionManager.BaseInterfaceType.Name, ReflectionManager.InvokeableAttributeType.Name));
     }
 }