Ejemplo n.º 1
0
        public void AddPageToTab(string tabTag, BaseControl.ControlBase control)
        {
            if (control == null) return;
            RadPageViewPage pageView = null;
            foreach (RadPageViewPage page in tabMain.Pages)
            {
                if (page.Tag == tabTag)
                {
                    pageView = page;
                    break;
                }
            }

            if (pageView != null)
            {
                tabMain.SelectedPage = pageView;
            }
            else
            {
                RadPageViewPage newPage = new RadPageViewPage()
                {
                    Tag = tabTag,
                    Text = control.PageCaption
                };

                tabMain.Pages.Add(newPage);
                tabMain.SelectedPage = newPage;

                control.Dock = DockStyle.Fill;
                control.Parent = newPage;
            }
        }
Ejemplo n.º 2
0
        public override void FromControl(BaseControl control)
        {
            base.FromControl(control);

            DropDownList dropDownList = control as DropDownList;
            selectedItemIdx = dropDownList.SelectedIndex;

            foreach (Label Label in dropDownList.Controls)
                items.Add(Label.Text);
        }
Ejemplo n.º 3
0
        public void HandleGesture(GestureSample gesture, BaseControl control)
        {
            var r = new RectangleF(control.Position, control.Size);
            if (r.Contains(gesture.Position))
            {
                switch (gesture.GestureType)
                {
                    case GestureType.Tap:
                        control.Trigger();
                        break;

                    case GestureType.DoubleTap:
                        control.Trigger();
                        break;
                }

                for (int i = 0; i < control.Children.Count; ++i)
                    HandleGesture(gesture, control.Children[i]);
            }
        }
Ejemplo n.º 4
0
        protected void HandleMouseControl(MouseState current, BaseControl control)
        {
            var r = new RectangleF(control.Position, control.Size);
            if (r.Contains(current.X, current.Y))
            {
                if (IsJustPressed(_prevState.LeftButton, current.LeftButton))
                {
                    if (LeftDown != null)
                        LeftDown(control);
                }
                else if (IsJustReleased(_prevState.LeftButton, current.LeftButton))
                {
                    if (LeftUp != null)
                        LeftUp(control);
                    control.Trigger();
                }

                for (int i = 0; i < control.Children.Count; i++)
                    HandleMouseControl(current, control.Children[i]);
            }
        }
Ejemplo n.º 5
0
        public static void _setTooTip(BaseControl control, String header, String htmlText, String footer)
        {
            SuperToolTip superToolTip = new SuperToolTip();

            ToolTipItem toolTipItem = new ToolTipItem();
            toolTipItem.Text = htmlText;
            toolTipItem.AllowHtmlText = DefaultBoolean.True;
            if (header != null)
            {
                superToolTip.Items.AddTitle(header);
            }
            superToolTip.Items.Add(toolTipItem);
            if (footer != null)
            {
                superToolTip.Items.AddSeparator();
                superToolTip.Items.AddTitle(footer);
            }
            superToolTip.AllowHtmlText = DefaultBoolean.True;

            control.SuperTip = superToolTip;
        }
Ejemplo n.º 6
0
        public void Init(object item)
        {
            foreach (PropertyInfo itemProperty in item.GetType().GetProperties())
            {
                if (itemProperty.CanRead)
                {
                    //object valueToAssign = Convert.ChangeType(itemProperty.GetValue(item, null), itemProperty.PropertyType);
                    //Type t = item.GetType();
                    //BaseControl c1 = new BaseControl("nazwa1", t);
                    //c1.InputValue = valueToAssign.ToString().Parse<t>;
                }
            }
            
            //BaseControl<Int32> c1 = new BaseControl<int>("nazwa1");
            //c1.InputValue = 100;
            BaseControl<Int32> c2 = new BaseControl<int>("nazwa2");
            BaseControl<Int32> c3 = new BaseControl<int>("nazwa3");
            //flowLayoutPanel1.Controls.Add(c1);
            flowLayoutPanel1.Controls.Add(c2);
            flowLayoutPanel1.Controls.Add(c3);

            //int v = c1.InputValue;
            //label1.Text = v.ToString();
        }
Ejemplo n.º 7
0
 /// <summary>
 ///     [EN] SetControlVisible
 ///     Create By: ManhNV1 -Date: 04/09/2016
 ///     Description: Set the value Enable for BaseControl
 /// </summary>
 /// <param name="paramControl">Array Control</param>
 /// <param name="valueSet">valueSet True or False</param>
 public static void SetControlEnable(BaseControl[] paramControl, bool valueSet)
 {
     foreach (var item in paramControl)
     {
         item.Enabled = valueSet;
     }
 }
Ejemplo n.º 8
0
 public Button(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
Ejemplo n.º 9
0
        private void CreateDynamicControls()
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                int    errCode = 0;
                string errText = "";
                try
                {
                    IRAPMDMClient.Instance.sfn_FunctionFormCtrls(
                        IRAPUser.Instance.CommunityID,
                        menuInfo.ItemID,
                        IRAPConst.Instance.IRAP_PROGLANGUAGEID,
                        IRAPUser.Instance.SysLogID,
                        ref controls,
                        out errCode,
                        out errText);
                    WriteLog.Instance.Write(string.Format("({0}){1}",
                                                          errCode, errText),
                                            strProcedureName);
                }
                catch (Exception error)
                {
                    WriteLog.Instance.Write(error.Message);
                    XtraMessageBox.Show(
                        error.Message,
                        Text,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }

                int intLogTop = 0;
                foreach (FormCtrlInfo control in controls)
                {
                    BaseControl objControl = null;
                    WriteLog.Instance.Write(
                        string.Format("创建控件:{0}", control.ToString()),
                        strProcedureName);
                    switch (control.CtrlType.ToUpper())
                    {
                    case "LABEL":
                        objControl = CreateLabel(control);
                        _labels.Add(objControl as LabelControl);
                        break;

                    case "EDITBOX":
                        objControl = CreateEdit(control);
                        if (firstFocusedObject == null && (objControl as TextEdit).Visible && (objControl as TextEdit).Enabled)
                        {
                            WriteLog.Instance.Write("设置获得焦点的第一个文本编辑控件", strProcedureName);
                            firstFocusedObject = objControl as TextEdit;
                        }
                        _edits.Add(objControl as TextEdit);
                        break;

                    case "SECURITYEDIT":
                        objControl = CreateSecurityEdit(control);
                        if (firstFocusedObject == null && (objControl as TextEdit).Visible && (objControl as TextEdit).Enabled)
                        {
                            WriteLog.Instance.Write("设置获得焦点的第一个安全文本编辑控件", strProcedureName);
                            firstFocusedObject = objControl as TextEdit;
                        }
                        _edits.Add(objControl as TextEdit);
                        break;

                    case "BUTTON":
                        objControl = CreateButton(control);
                        _buttons.Add(objControl as SimpleButton);

                        if (mustAllInputButton == null)
                        {
                            mustAllInputButton = objControl as SimpleButton;
                            // 强制设置第一个按钮的功能为 ButtonSaveDataClick
                            mustAllInputButton.Click += new EventHandler(this.ButtonSaveDataClick);

                            busUDFForm.NumTransToApply = control.NumTransToApply;
                            busUDFForm.NumFactsToApply = control.NumFactsToApply;
                        }

                        break;
                    }

                    if (objControl.Visible)
                    {
                        if (intLogTop <= objControl.Top + objControl.Height)
                        {
                            intLogTop = objControl.Top + objControl.Height;
                        }
                    }
                }

                if (_buttons.Count >= 2)
                {
                    reprintLabelButton = _buttons[1];
                    // 强制设置第二个按钮的功能为 ReprintLabel
                    reprintLabelButton.Click += this.ButtonReprintClick;
                }

                // 为第三个及以后的按钮订阅单击事件
                for (int i = 2; i < _buttons.Count; i++)
                {
                    if ((_buttons[i].Tag as FormCtrlInfo).RunFormClassName.Trim() == "")
                    {
                        _buttons[i].Click += new EventHandler(this.ButtonSaveDataClick);
                    }
                    else
                    {
                        _buttons[i].Click += new EventHandler(this.ButtonOpenFormClick);
                    }
                }

                // 设置日志的位置和大小
                xucIRAPListView.Top      = intLogTop + xucIRAPListView.Left;
                xucIRAPListView.Width    = pnlBody.Width - xucIRAPListView.Left * 2;
                xucIRAPListView.Height   = pnlBody.Height - xucIRAPListView.Top - xucIRAPListView.Left;
                xucIRAPListView.Anchor   = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top;
                xucIRAPListView.TabIndex = controls.Count + 1;
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Ejemplo n.º 10
0
        public void RemoveWindow(BaseFrame window)
        {
            List<BaseFrame> windows = new List<BaseFrame>(this.windows);
            windows.Remove(window);
            this.windows = windows.ToArray();

            if (focusedControl != window) return;
            if (this.windows.Length == 0) focusedControl = null;
            focusedControl = this.windows[0];
        }
Ejemplo n.º 11
0
 public ProgressBar(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
Ejemplo n.º 12
0
        private static NodeCollection BuildAreasLevel()
        {
            string        path = HttpContext.Current.Server.MapPath(ExamplesModel.ExamplesRoot);
            DirectoryInfo root = new DirectoryInfo(path);

            DirectoryInfo[] folders = root.GetDirectories();
            folders = ExamplesModel.SortFolders(root, folders);

            NodeCollection nodes = new NodeCollection(false);

            var staticIcons = new StaticNodeIcon(path);

            foreach (DirectoryInfo folder in folders)
            {
                if ((folder.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden ||
                    excludeList.Contains(folder.Name) || folder.Name.StartsWith("_"))
                {
                    continue;
                }

                ExampleConfig cfg = new ExampleConfig(folder.FullName + "\\config.xml");

                string iconCls = string.IsNullOrEmpty(cfg.IconCls) ? "" : cfg.IconCls;
                Node   node    = null;
                var    index   = folder.Name.IndexOf('_');

                if (cfg.MainGroup || index < 0)
                {
                    node        = new Node();
                    node.NodeID = BaseControl.GenerateID();
                    node.Text   = folder.Name.Replace("_", " ");

                    nodes.Add(node);

                    if (String.IsNullOrWhiteSpace(iconCls))
                    {
                        staticIcons.TryGetIconCLS(out iconCls, folder.Name);
                    }

                    node.IconCls = iconCls;

                    flagNode(ref node, folder.FullName);
                }
                else
                {
                    string otherIconCls;
                    var    mainGroupName = folder.Name.Substring(0, index);
                    node = nodes.FirstOrDefault(n => n.Text == mainGroupName);

                    if (node == null)
                    {
                        node        = new Node();
                        node.NodeID = BaseControl.GenerateID();
                        node.Text   = mainGroupName;
                        nodes.Add(node);
                    }

                    if (staticIcons.TryGetIconCLS(out otherIconCls, mainGroupName))
                    {
                        node.IconCls = otherIconCls;
                    }

                    flagNode(ref node, folder.FullName);

                    var groupNode        = new Node();
                    var subGroupNodeName = folder.Name.Substring(index + 1);

                    groupNode.NodeID = BaseControl.GenerateID();
                    groupNode.Text   = subGroupNodeName.Replace("_", " ");

                    if (iconCls.IsNotEmpty())
                    {
                        groupNode.IconCls = iconCls;
                    }
                    else if (staticIcons.TryGetIconCLS(out otherIconCls, mainGroupName, subGroupNodeName))
                    {
                        groupNode.IconCls = otherIconCls;
                    }

                    flagNode(ref node, folder.FullName);

                    node.Children.Add(groupNode);
                    node = groupNode;
                }

                ExamplesModel.BuildViewsLevel(folder, node);
            }

            return(nodes);
        }
Ejemplo n.º 13
0
                public UserNote( BaseControl.CreateParams createParams, float deviceHeight, Model.NoteState.UserNoteContent userNoteContent, UserNoteChanged onUserNoteChanged )
                {
                    PositionTransform = new PointF( createParams.Width, createParams.Height );

                    PointF startPos = new PointF( userNoteContent.PositionPercX * PositionTransform.X, userNoteContent.PositionPercY * PositionTransform.Y );
                    Create( createParams, deviceHeight, startPos, userNoteContent.Text, onUserNoteChanged );

                    // since we're restoring an existing user note,
                    // we want to turn off scaling so we can adjust the height
                    // for all the text
                    TextView.ScaleHeightForText = false;

                    TextView.SizeToFit( );

                    // a small hack, but calling SizeToFit breaks
                    // the note width, so this will restore it.
                    ValidateBounds( );

                    // now we can turn it back on so that if they continue to edit,
                    // it will grow.
                    TextView.ScaleHeightForText = true;

                    // new notes are open by default. So if we're restoring one that was closed,
                    // keep it closed.
                    if ( userNoteContent.WasOpen == false )
                    {
                        CloseNote( );
                    }
                    else
                    {
                        // open up the text field WITHOUT animating
                        // the textView
                        TextView.Hidden = false;
                        AnimateNoteIcon( true );
                        AnimateUtilityView( true );
                    }
                }
Ejemplo n.º 14
0
 public override void Initialise(BaseControl parent)
 {
     base.Initialise(parent);
     if (FormatItems == null)
     {
         FormatItems = new List<FormatItem>();
         var fi = new FormatItem();
         fi.ItemType = FormatItem.FormatItemType.Text;
         FormatItems.Add(fi);
     }
 }
Ejemplo n.º 15
0
 private void AddToDataToComboBox(MasterType masterType, BaseControl cbb1, BindingSource s)
 {
     var universalMasterCreateForm =
         GlobalUtility.GetFormObject<UniversalMasterCreateForm>(FormConstants.UNIVERASAL_MASTER_CREATE_FORM);
     universalMasterCreateForm.IsNeedClosing = true;
     universalMasterCreateForm.MasterType = masterType;
     universalMasterCreateForm.ShowDialog();
     ComboBoxEdit edit1;
     ListBoxControl edit2;
     object obj = universalMasterCreateForm.CreatedItem;
     if (obj != null)
     {
         int index = 0;
         switch (masterType)
         {
             case MasterType.PRODUCT_TYPE:
                 edit1 = (ComboBoxEdit) cbb1;
                 foreach (ProductType type in edit1.Properties.Items)
                 {
                     if (type.TypeId.Equals(((ProductType) obj).TypeId))
                     {
                         edit1.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;
             case MasterType.PRODUCT_SIZE:
                 edit2 = (ListBoxControl) cbb1;
                 foreach (ProductSize type in edit2.Items)
                 {
                     if (type.SizeId.Equals(((ProductSize) obj).SizeId))
                     {
                         edit2.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;
             case MasterType.PRODUCT_COLOR:
                 edit2 = (ListBoxControl) cbb1;
                 foreach (ProductColor type in edit2.Items)
                 {
                     if (type.ColorId.Equals(((ProductColor) obj).ColorId))
                     {
                         edit2.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;
             /*case MasterType.COUNTRY:
                 foreach (Country type in cbb1.Items)
                 {
                     if (type.CountryId.Equals(((Country) obj).CountryId))
                     {
                         cbb1.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;
             case MasterType.DISTRIBUTOR:
                 foreach (Distributor type in cbb1.Items)
                 {
                     if (type.DistributorId.Equals(((Distributor) obj).DistributorId))
                     {
                         cbb1.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;
             case MasterType.MANUFACTURER:
                 foreach (Manufacturer type in cbb1.Items)
                 {
                     if (type.ManufacturerId.Equals(((Manufacturer) obj).ManufacturerId))
                     {
                         cbb1.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;
             case MasterType.PACKAGER:
                 foreach (Packager type in cbb1.Items)
                 {
                     if (type.PackagerId.Equals(((Packager) obj).PackagerId))
                     {
                         cbb1.SelectedIndex = index;
                         return;
                     }
                     index++;
                 }
                 break;*/
         }
         s.Add(obj);
         edit1 =  cbb1 as ComboBoxEdit;
         edit2 =  cbb1 as ListBoxControl;
         if(edit1!=null) edit1.SelectedIndex = s.Count - 1;
         if (edit2 != null) edit2.SelectedIndex = s.Count - 1;
         Refresh();
     }
 }
Ejemplo n.º 16
0
 public void ChangeControl(Controls control)
 {
     currentControl = (BaseControl)Activator.CreateInstance(controls[control]);
     grid_main.Children.Clear();
     grid_main.Children.Add(currentControl);
 }
Ejemplo n.º 17
0
Archivo: Label.cs Proyecto: tpb3d/TPB3D
 public Label(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
Ejemplo n.º 18
0
        public override void FromControl(BaseControl control)
        {
            base.FromControl(control);
            OptionGroup optionGroup = control as OptionGroup;

            selectedOptionIdx = optionGroup.SelectedIndex;
            foreach (OptionButton optionButton in optionGroup.Controls)
            {
                options.Add(optionButton.Caption);
            }
        }
Ejemplo n.º 19
0
 public Picture(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
Ejemplo n.º 20
0
 public ListBox(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
Ejemplo n.º 21
0
Archivo: Unit.cs Proyecto: Kinderril/p3
 public virtual void Init()
 {
     Parameters = ParametersScriptable.Get();
     var spd = Parameters[ParamType.Speed];
     if (spd != 0 && spd < 50)
     { 
         spd *= Formuls.SpeedCoef;
         Debug.LogError("Wrong speed " + name);
     }
     Parameters[ParamType.Speed] = spd / Formuls.SpeedCoef;
     if (Control == null)
         Control = GetComponent<BaseControl>();
     if (animationController == null)
         animationController = GetComponentInChildren<AnimationController>();
     if(animationController == null)
         Debug.LogError("NO ANImator Controller");
     curHp = Parameters[ParamType.Heath];
     //List<Weapon> weapons = new List<Weapon>();
     foreach (var inventoryWeapon in InventoryWeapons)
     {
         inventoryWeapon.Init(this, null);
         inventoryWeapon.gameObject.SetActive(false);
         inventoryWeapon.transform.SetParent(weaponsContainer,true);
     }
     Control.SetSpeed(Parameters[ParamType.Speed]);
     if (InventoryWeapons.Count == 0)
     {
         Debug.LogWarning("NO WEAPON!!! " + gameObject.name);
         return;
     }
     InitWEapons();
     curWeapon = InventoryWeapons[0];
     curWeapon.gameObject.SetActive(true);
     OnShieldOff = new IEndEffect();
 }
Ejemplo n.º 22
0
 public CheckBox(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
Ejemplo n.º 23
0
 public MouseInput(BaseControl rootControl)
 {
     RootControl = rootControl;
 }
Ejemplo n.º 24
0
 public Textbox(BaseFrameMgr frameMgr, BaseControl parent)
     : base(frameMgr, parent)
 {
 }
 /// The constructor
 public SteeringMgr(BaseControl host, float MAX_VELOCITY)
 {
     this.host = host;
     this.steering = Vector3.zero;
     this.MAX_VELOCITY = MAX_VELOCITY;
 }
Ejemplo n.º 26
0
        public ScrollBar(BaseFrameMgr frameMgr, BaseControl parent)
            : base(frameMgr, parent)
        {

        }
        private Vector3 separation(
            BaseControl curAgent, 
                List<BaseControl> boids, 
                    float SEPARATION_RADIUS, 
                        float MAX_SEPARATION)
        {
            var separation = Vector3.zero;

            int neighborCount = 0;

            //var agentTransform = agents[curAgent].transform;

            // Loop through each agent to determine the separation
            for (int i = 0; i < boids.Count; ++i)
            {
                // The agent can't compare against itself
                if (curAgent != boids[i])
                {
                    // Only determine the parameters if the other agent is its neighbor
                    if (Vector3.SqrMagnitude(boids[i].transform.position - curAgent.transform.position) < (SEPARATION_RADIUS * SEPARATION_RADIUS))
                    {
                        // This agent is the neighbor of the original agent so add the separation
                        separation += boids[i].transform.position - curAgent.transform.position;

                        neighborCount++;
                    }
                }
            }

            // Don't move if there are no neighbors
            if (neighborCount == 0)
            {
                return Vector3.zero;
            }

            //Debug.Log(curAgent.name + " this ? " + neighborCount);

            // Normalize the value
            return ((separation / neighborCount) * -1).normalized * (MAX_SEPARATION);
        }
Ejemplo n.º 28
0
        public void AddWindow(BaseFrame window)
        {
            List<BaseFrame> windows = new List<BaseFrame>(this.windows);
            windows.Add(window);
            this.windows = windows.ToArray();

            if (focusedControl == null) focusedControl = window;
        }
Ejemplo n.º 29
0
 public void OnSettingChanged(BaseControl setting)
 {
     Debug.Log(setting.ToString() + "changed setting to option " + setting.ControlValue().ToString());
 }
Ejemplo n.º 30
0
 public WP7Touch(BaseControl root)
 {
     RootControl = root;
 }
Ejemplo n.º 31
0
 public MouseInput(BaseControl rootControl)
 {
     RootControl = rootControl;
 }
Ejemplo n.º 32
0
 public virtual void Init()
 {
     Parameters = Parameters.Copy();
     if (Control == null)
         Control = GetComponent<BaseControl>();
     animationController = GetComponentInChildren<AnimationController>();
     if(animationController == null)
         Debug.LogError("NO ANImator Controller");
     curHp = Parameters.Parameters[ParamType.Hp];
     //List<Weapon> weapons = new List<Weapon>();
     foreach (var inventoryWeapon in InventoryWeapons)
     {
         inventoryWeapon.Init(this, null);
         inventoryWeapon.gameObject.SetActive(false);
     }
     Control.SetSpped(Parameters.Parameters[ParamType.Speed]);
     if (InventoryWeapons.Count == 0)
     {
         Debug.LogWarning("NO WEAPON!!! " + gameObject.name);
         return;
     }
     InitWEapons();
     curWeapon = InventoryWeapons[0];
     curWeapon.gameObject.SetActive(true);
     OnShieldOff = new IEndEffect();
 }
Ejemplo n.º 33
0
        public HttpResponseMessage Index(string jsonData)
        {
            try
            {
                StringBuilder sb     = new StringBuilder();
                string        formId = Guid.NewGuid().ToString();
                sb.Append($"<form id=\"{formId}\" action=\"/home/form\" method=\"post\"><input type=\"hidden\" name=\"formId\" value=\"{formId}\"/>");
                JObject     formData = JObject.Parse(jsonData);
                int         index    = 0;
                BaseControl ctrl     = null;
                if (!formData.ContainsKey("form"))
                {
                    ctrl = new TextBoxControl()
                    {
                        Type = "text", ClassName = "form-control", Id = "hi", Label = "Hello!", Name = "hi"
                    };
                    sb.Append(ctrl.ToString());
                    ctrl = new ButtonControl()
                    {
                        ClassName = "btn btn-primary", Value = "Save", Type = "submit"
                    };
                    sb.Append(ctrl.ToString());
                    sb.Append("</form>");
                    TempData["htmlTemplate"] = sb.ToString();
                    return(new HttpResponseMessage()
                    {
                        StatusCode = HttpStatusCode.OK
                    });
                }

                foreach (JObject item in formData["form"])
                {
                    string label = item["label"].ToString();
                    string type  = item["type"].ToString();
                    switch (type)
                    {
                    case "text":
                        ctrl = new TextBoxControl()
                        {
                            Type = type, ClassName = "form-control", Id = index.ToString(), Label = label, Name = index.ToString()
                        };
                        sb.Append(ctrl.ToString());
                        break;

                    case "checkbox":
                    case "radio":
                        if (item.ContainsKey("options"))
                        {
                            ctrl = new CheckBoxOrRadioButtonControl()
                            {
                                Type      = type,
                                Label     = label,
                                Id        = index.ToString(),
                                Options   = (JArray)item["options"],
                                ClassName = "form-check-input",
                                Name      = index.ToString(),
                            };

                            sb.Append(ctrl.ToString());
                        }
                        break;
                    }
                    ;

                    index++;
                }

                ctrl = new ButtonControl()
                {
                    ClassName = "btn btn-primary", Value = "Save", Type = "submit"
                };
                sb.Append(ctrl.ToString());
                sb.Append("</form>");
                TempData["htmlTemplate"] = sb.ToString();
                return(new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.OK
                });
            }
            catch (Exception ex)
            {
                throw new HttpRequestException(ex.Message);
            }
        }