Esempio n. 1
0
        public virtual void                             AddValuesFromType(ModelRangeAttribute attr, Type type)
        {
            //Use the attribute, if specified
            if (attr != null && attr.Type != null)
            {
                type = attr.Type;
            }
            if (type != null)
            {
                //Infer values from the type
                if (type.IsEnum)
                {
#if (!(SmartPhone || WindowsCE || PocketPC))    //Enum.GetValues not supported on .Net CF
                    //Add all the values
                    foreach (object e in Enum.GetValues(type))
                    {
                        _values.Add(new ModelValue(type, e));
                    }
#endif //(!(SmartPhone || WindowsCE || PocketPC))
                }
                else if (type == typeof(bool))
                {
                    _values.Add(new ModelValue(type, true));
                    _values.Add(new ModelValue(type, false));
                }
            }
        }
Esempio n. 2
0
        //Accessors
        public virtual void                    SetAttributeValues(ModelRangeAttribute attr)
        {
            base.SetAttributeValues(attr);
            if (attr != null)
            {
                _conjunction = attr.Conjunction;

                //Specified variable
                if (attr.Variable != null && this.Model != null)
                {
                    _variable = DetermineVariable(attr.Variable);
                }

                //Copy the value array (so modifications don't muck with the original static model)
                _values.Clear();
                _values.Add(attr._values);
            }
        }
Esempio n. 3
0
 //Constructor
 public ModelRange(Model model, ModelRangeAttribute attr)
     : base(model, attr)
 {
     SetAttributeValues(attr);
 }