A field for integer values Un campo para valores enteros.

상속: TextBoxField
예제 #1
0
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia una instancia del objeto Form
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

			// Inicialize an new instance of the class Form
			Form = new Form();

			// Inicialize an new intsance of the class IntegerField, with Name, Value and text especific and adds it to the Form
			IntegerField intField = new IntegerField();
			intField.Name = "id";
			intField.Value = 5;
			intField.CaptionControl.Text = "id";
			intField.Required = true;
			intField.Container = Form;
			Form.Fields.Add(intField);

			// Inicialize an new intsance of the class StringField, with Name, Value and text especific and adds it to the Form
			StringField stringField = new StringField();
			stringField.Name = "name";
			stringField.Value = "";
			stringField.CaptionControl.Text = "name";
			stringField.Required = true;
			stringField.Container = Form;
			Form.Fields.Add(stringField);

			// Establishes the number of columns of the Form and the position of the captions.
			Form.RepeatColumns = 4;
			Form.LabelPosition = CaptionPosition.Left;
			Form.DataBind();

			// Creates the Button cmdSave with text specific, with the event also click.
			IButton cmdSave = Platform.Current.Create<IButton>();
			cmdSave.Text = "Save";
			cmdSave.Click += CmdSave_Click;

			// Create a new Stack.
			IStack stack = Platform.Current.Create<IStack>();
			// Adds the content of the Form and the button cmdSave it to the stack
			stack.Children.Add(Form.Content);
			stack.Children.Add(cmdSave);

			// Establishes the content and title of the page
			Platform.Current.Page.Title = "Form";
			Platform.Current.Page.Content = stack;
		}
예제 #2
0
		/// <summary>
		/// Creates a field that will contain a value of a specific type
		/// <para xml:lang="es">
		/// Crea un campo que contendra un valor de un tipo especifico.
		/// </para>
		/// </summary>
		public static FormField CreateFieldFrom(Type type)
		{
			//validate arguments
			if (type == null) throw new ArgumentNullException("type");

			//field
			FormField field;

			//Enum
			if (type.GetTypeInfo().IsEnum)
			{
				field = new EnumField(type);
			}

			//Type, ignore this since we can't know if type means Person (as in a serializable object) or typeof(Person) as a type which child types you would choose from
			//else if (type.Equals(typeof(Type)))
			//{
			//	field = new TypeField();
			//}

			//Bool
			else if (type.Equals(typeof(bool)))
			{
				field = new BoolField();
			}

			//DateTime
			else if (type.Equals(typeof(DateTime)))
			{
				field = new DateTimeField();
			}

			//Numeric
			else if (type.IsNumeric())
			{
				if (type.IsIntegral())
				{
					field = new IntegerField();
				}
				else
				{
					field = new DecimalField();
				}
			}

			//String serializable
			else if (type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(Data.IStringSerializable)))
			{
				field = new StringSerializableField(type);
			}

			//XML
			else if (type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(System.Xml.Serialization.IXmlSerializable)))
			{
				field = new XmlSerializableField(type);
			}

			//String
			else if (type.Equals(typeof(string)))
			{
				field = new StringField();
			}

			//byte[]
			else if (type.Equals(typeof(byte[])))
			{
				field = new BinaryField();
			}

			//otherwise just create a textbox
			else
			{
				field = new StringField();
			}

			//return
			return field;
		}
예제 #3
0
        /// <summary>
        /// Creates a field that will contain a value of a specific type
        /// <para xml:lang="es">
        /// Crea un campo que contendra un valor de un tipo especifico.
        /// </para>
        /// </summary>
        public static FormField CreateFieldFrom(Type type)
        {
            //validate arguments
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            //field
            FormField field;

            //Enum
            if (type.GetTypeInfo().IsEnum)
            {
                field = new EnumField(type);
            }

            //Type, ignore this since we can't know if type means Person (as in a serializable object) or typeof(Person) as a type which child types you would choose from
            //else if (type.Equals(typeof(Type)))
            //{
            //	field = new TypeField();
            //}

            //Bool
            else if (type.Equals(typeof(bool)))
            {
                field = new BoolField();
            }

            //DateTime
            else if (type.Equals(typeof(DateTime)))
            {
                field = new DateTimeField();
            }

            //Numeric
            else if (type.IsNumeric())
            {
                if (type.IsIntegral())
                {
                    field = new IntegerField();
                }
                else
                {
                    field = new DecimalField();
                }
            }

            //String serializable
            else if (type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(Data.IStringSerializable)))
            {
                field = new StringSerializableField(type);
            }

            //XML
            else if (type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(System.Xml.Serialization.IXmlSerializable)))
            {
                field = new XmlSerializableField(type);
            }

            //String
            else if (type.Equals(typeof(string)))
            {
                field = new StringField();
            }

            //byte[]
            else if (type.Equals(typeof(byte[])))
            {
                field = new BinaryField();
            }

            //otherwise just create a textbox
            else
            {
                field = new StringField();
            }

            //return
            return(field);
        }