示例#1
0
        public string formatProperty(VirtualProperty property)
        {
            string delimiter = property.Delimited ? "," : "";

            if (property.Assigned == true)
            {
                string pValue = (string)property.GetValue(this);
                if (pValue.Equals(""))
                {
                    pValue = "?";
                }

                return(delimiter + property.Name + "=" + pValue);
            }
            else
            {
                if (property.Keyword == true)
                {
                    return(delimiter + property.Name);
                }
                else
                {
                    return(delimiter + property.GetValue(this));
                }
            }
        }
示例#2
0
        public VirtualProperty Add(string name, string parm, Constraint[] constraints, bool required, string description)
        {
            Attribute[] attributes;

            int count = 2;
            //int count = 3;
            bool constrainedByList = false;

            if (constraints != null)
            {
                foreach (Constraint constraint in constraints)
                {
                    if (constraint is ListConstraint)
                    {
                        count++;
                        constrainedByList = true;
                        break;
                    }
                }
            }

            if (description != null)
            {
                count++;
            }

            attributes = new Attribute[count];

            count--;

            attributes[count--] = new DefaultValueAttribute(typeof(string), parm);

            if (required == true)
            {
                attributes[count--] = REQUIRED_CATEGORY_ATTRIBUTE;
            }
            else
            {
                attributes[count--] = OPTIONAL_CATEGORY_ATTRIBUTE;
            }

            if (description != null)
            {
                attributes[count--] = new DescriptionAttribute(description);
            }

            if (constrainedByList == true)
            {
                attributes[count--] = new TypeConverterAttribute(typeof(MyConverter));
            }

            //attributes[count--] = new EditorAttribute(typeof(CBEditor), typeof(UITypeEditor));

            VirtualField vf = new VirtualField(this, parm, name);

            VirtualProperty vpx = new VirtualProperty(vf, constraints, attributes);

            properties.Add(vpx);
            vpx.AddValueChanged(this, new EventHandler(ValueChanged));
            //vpx.OnPropertyError += new csi.property.VirtualProperty.OnPropertyErrorHandler(vpx_OnPropertyError);
            return(vpx);
        }
示例#3
0
        //	#region EVENTS THROWN
        //	public event OnPropertyErrorHandler OnPropertyError;
//
//		public delegate void OnPropertyErrorHandler(object sender, string property, string message);
//		#endregion

        public override bool Equals(object obj)
        {
            VirtualProperty other = obj as VirtualProperty;

            return(other != null && other._field.Equals(_field));
        }