public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            ElementPropertyDescriptor propertyDescriptor = context.PropertyDescriptor as ElementPropertyDescriptor;
            if (propertyDescriptor != null)
            {
                ModelProperty underlyingModelElement = propertyDescriptor.ModelElement as ModelProperty;

                ArrayList list = null;

                string actualValue = value as string;

                if (!string.IsNullOrEmpty(actualValue))
                    list = ModelProperty.DeserializeValidatorList(actualValue);

                PropertyValidationEditorForm editor = new PropertyValidationEditorForm(list);
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    if (editor.Value != null)
                        value = ModelProperty.SerializeValidatorList(editor.Value);
                    else
                        value = null;
                }
            }

            return value;
        }
Esempio n. 2
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            ElementPropertyDescriptor propertyDescriptor = context.PropertyDescriptor as ElementPropertyDescriptor;

            if (propertyDescriptor != null)
            {
                ModelProperty underlyingModelElement = propertyDescriptor.ModelElement as ModelProperty;

                ArrayList list = null;

                string actualValue = value as string;

                if (!string.IsNullOrEmpty(actualValue))
                {
                    list = ModelProperty.DeserializeValidatorList(actualValue);
                }

                PropertyValidationEditorForm editor = new PropertyValidationEditorForm(list);
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    if (editor.Value != null)
                    {
                        value = ModelProperty.SerializeValidatorList(editor.Value);
                    }
                    else
                    {
                        value = null;
                    }
                }
            }

            return(value);
        }