CreateFieldFrom() public static method

Creates a field that will contain a value of a specific type Crea un campo que contendra un valor de un tipo especifico.

public static CreateFieldFrom ( Type type ) : FormField
type System.Type
return FormField
Exemplo n.º 1
0
        /// <summary>
        /// Adds a field for every argument that the DataMethos needs in order to be invoked
        /// </summary>
        /// <param name="method">DataMethod which parameters will be used as fields</param>
        public virtual void AddFields(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException("dmethod");
            }
            uint order = 0;

            //add a field for each parameter
            foreach (ParameterInfo param in method.GetParameters())
            {
                FormField field;

                field = FormField.CreateFieldFrom(param.ParameterType);

                //set common values
                field.Container           = this;
                field.Name                = param.Name;
                field.Required            = !param.IsOptional && !param.IsOut;
                field.CaptionControl.Text = new System.Resources.ResourceManager(method.DeclaringType).GetString(method.GetFriendlyFullName().Replace('.', '_') + '_' + param.Name);
                field.SortOrder           = order++;

                Fields.Add(field);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates the field of specified type.
 /// <para xml:lang="es">Crea el campo del tipo especificado.</para>
 /// </summary>
 /// <returns>The field from.</returns>
 /// <param name="type">Type.</param>
 protected virtual FormField CreateFieldFrom(Type type)
 {
     return(FormField.CreateFieldFrom(type));
 }