Example #1
0
        private int GetVirtualPropertyControl(ArchAngel.Interfaces.ITemplate.IUserOption option, int CurrentRowHeight)
        {
            Label labelPropertyName = new Label();

            labelPropertyName.Text = option.Text;

            Control inputControl;

            if (VirtualPropertyHelper.IsEnumType(option))
            {
                inputControl = AddEnumInputControl(option);
            }
            else if (VirtualPropertyHelper.IsStringType(option))
            {
                inputControl = AddStringInputControl(option);
            }
            else if (VirtualPropertyHelper.IsIntegerNumericType(option))
            {
                inputControl = AddIntegerInputControl(option);
            }
            else if (VirtualPropertyHelper.IsCharType(option))
            {
                inputControl = AddCharInputControl(option);
            }
            else if (VirtualPropertyHelper.IsDecimalNumericType(option))
            {
                inputControl = AddDecimalInputControl(option);
            }
            else if (VirtualPropertyHelper.IsBoolType(option))
            {
                inputControl = AddBoolInputControl(option);
            }
            else
            {
                throw new NotImplementedException("Not handled yet");
            }
            //return;

            labelPropertyName.Left     = 5;
            labelPropertyName.AutoSize = true;
            inputControl.Left          = labelPropertyName.PreferredWidth + 15;
            inputControl.Top           = labelPropertyName.Top = CurrentRowHeight;
            inputControl.Width         = Control.Width - inputControl.Left - 5;

            bool propertyEnabled = option.DisplayToUser;

            inputControl.Enabled = propertyEnabled;

            labelPropertyName.Anchor = AnchorStyles.Left | AnchorStyles.Top;
            inputControl.Anchor      = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            Control.Controls.Add(labelPropertyName);
            Control.Controls.Add(inputControl);

            if (propertyEnabled)
            {
                SetTooltip(labelPropertyName, "", option.Description);
            }
            else
            {
                SetTooltip(labelPropertyName, "Disabled", option.Description);
            }

            //CurrentRowHeight += 40;

            //Height = CurrentRowHeight + 50;
            return(Math.Max(labelPropertyName.Bottom, inputControl.Bottom));
        }
Example #2
0
        private int AddUserOption(ArchAngel.Interfaces.ITemplate.IUserOption userOption, int top, int width)
        {
            int newTop = AddLabel(userOption.Text, top, width);

            return(newTop);
        }