示例#1
0
        private void RecursiveGenerateControls(ArgumentStruct oArg)
        {
            Control control1;
            switch (oArg.Name)
            {
                case "layout":
                    foreach (string sEnumValue in oArg.EnumValues)
                    {
                        ddlLayoutType.Items.Add(sEnumValue);
                    }
                    ddlLayoutType.Text = oArg.Value;
                    break;
                case "conversionPattern":
                    txtConversionPattern.Text = oArg.Value;
                    break;
                default:
                    Label label1 = new Label();
                    label1.Text = oArg.Name + " : ";
                    label1.AutoSize = true;
                    switch (oArg.UIType)
                    {
                        case UIControlType.MultiLineTextBox:
                            control1 = new TextBox();
                            ((TextBox) control1).Multiline = true;
                            ((TextBox) control1).ScrollBars = ScrollBars.Both;
                            ((TextBox) control1).Text = oArg.Value;
                            control1.Height *= 5;
                            break;

                        case UIControlType.DropDownList:
                            control1 = new ComboBox();
                            ((ComboBox) control1).DropDownStyle = ComboBoxStyle.DropDownList;
                            foreach (string text2 in oArg.EnumValues)
                            {
                                ((ComboBox) control1).Items.Add(text2);
                            }
                            ((ComboBox) control1).Text = oArg.Value;
                            break;

                        case UIControlType.ListBox:
                            control1 = new ListBox();
                            foreach (string text1 in oArg.EnumValues)
                            {
                                ((ListBox) control1).Items.Add(text1);
                            }
                            ((ListBox) control1).Text = oArg.Value;
                            break;

                        case UIControlType.ParameterGrid:
                            control1 = new ParameterGrid();
                            ((ParameterGrid)control1).ParameterXmlNodes = oArg.ParameterXml;
                            break;

                        case UIControlType.None:
                            control1 = new Label();
                            break;

                        default:
                            control1 = new TextBox();
                            ((TextBox) control1).Text = oArg.Value;
                            break;
                    }
                    control1.Tag = oArg.Name;
                    toolTip.SetToolTip(control1, oArg.Description);
                    argPanel.Controls.Add(label1);
                    argPanel.Controls.Add(control1);
                    break;
            }
            if (oArg.ChildArguments != null)
            {
                foreach (ArgumentStruct struct1 in oArg.ChildArguments)
                {
                    RecursiveGenerateControls(struct1);
                }
            }
        }
示例#2
0
        private void RecursiveGenerateControls(ArgumentStruct oArg)
        {
            Control control1;

            switch (oArg.Name)
            {
            case "layout":
                foreach (string sEnumValue in oArg.EnumValues)
                {
                    ddlLayoutType.Items.Add(sEnumValue);
                }
                ddlLayoutType.Text = oArg.Value;
                break;

            case "conversionPattern":
                txtConversionPattern.Text = oArg.Value;
                break;

            default:
                Label label1 = new Label();
                label1.Text     = oArg.Name + " : ";
                label1.AutoSize = true;
                switch (oArg.UIType)
                {
                case UIControlType.MultiLineTextBox:
                    control1 = new TextBox();
                    ((TextBox)control1).Multiline  = true;
                    ((TextBox)control1).ScrollBars = ScrollBars.Both;
                    ((TextBox)control1).Text       = oArg.Value;
                    control1.Height *= 5;
                    break;

                case UIControlType.DropDownList:
                    control1 = new ComboBox();
                    ((ComboBox)control1).DropDownStyle = ComboBoxStyle.DropDownList;
                    foreach (string text2 in oArg.EnumValues)
                    {
                        ((ComboBox)control1).Items.Add(text2);
                    }
                    ((ComboBox)control1).Text = oArg.Value;
                    break;

                case UIControlType.ListBox:
                    control1 = new ListBox();
                    foreach (string text1 in oArg.EnumValues)
                    {
                        ((ListBox)control1).Items.Add(text1);
                    }
                    ((ListBox)control1).Text = oArg.Value;
                    break;

                case UIControlType.ParameterGrid:
                    control1 = new ParameterGrid();
                    ((ParameterGrid)control1).ParameterXmlNodes = oArg.ParameterXml;
                    break;

                case UIControlType.None:
                    control1 = new Label();
                    break;

                default:
                    control1 = new TextBox();
                    ((TextBox)control1).Text = oArg.Value;
                    break;
                }
                control1.Tag = oArg.Name;
                toolTip.SetToolTip(control1, oArg.Description);
                argPanel.Controls.Add(label1);
                argPanel.Controls.Add(control1);
                break;
            }
            if (oArg.ChildArguments != null)
            {
                foreach (ArgumentStruct struct1 in oArg.ChildArguments)
                {
                    RecursiveGenerateControls(struct1);
                }
            }
        }