Example #1
0
        public void a_basic_test()
        {
            var registry = new FubuRegistry(x =>
            {
                x.HtmlConvention <DefaultHtmlConventions>();
            });
            var container = new Container();

            FubuApplication.For(registry).StructureMap(container).Bootstrap();

            var tags = container.GetInstance <TagGenerator <AddressViewModel> >();

            tags.Model = new AddressViewModel()
            {
                ShouldShow = true
            };

            var form = new SimpleForm <AddressViewModel, DefinitionListLabelAndField>(tags);

            theRenderedFormLine = form.Display(p => p.ShouldShow);

            var xx = theRenderedFormLine.Render();

            xx.ShouldContain(tags.LabelFor(x => x.ShouldShow).ToString());
            xx.ShouldContain(tags.DisplayFor(x => x.ShouldShow).ToString());
        }
        private void ExecuteSelectPaymentMethod(Player player, SimpleForm form)
        {
            var simpleForm = new SimpleForm();

            simpleForm.Title   = "Checkout - Select payment method";
            simpleForm.Content = "Select the payment method you like to use for your purchase.";
            simpleForm.Buttons = new List <Button>()
            {
                new Button {
                    Text = "Pay with VISA", Image = new Image {
                        Type = "url", Url = "http://www.credit-card-logos.com/images/visa_credit-card-logos/visa_logo_6.gif"
                    }, ExecuteAction = ExecutePayVisa
                },
                new Button {
                    Text = "Pay with Mastercard", Image = new Image {
                        Type = "url", Url = "http://www.credit-card-logos.com/images/mastercard_credit-card-logos/mastercard_logo_6.gif"
                    }
                },
                new Button {
                    Text = "Use PayPal", Image = new Image {
                        Type = "url", Url = "http://logok.org/wp-content/uploads/2014/05/Paypal-logo-20141.png"
                    }
                },
                new Button {
                    Text = "Cancel"
                },
            };

            player.SendForm(simpleForm);
        }
Example #3
0
        public SimpleFormDialog(uint formId, BedrockFormManager parent, SimpleForm form, InputManager inputManager) : base(formId, parent, inputManager)
        {
            StackMenu             = new GuiStackMenu();
            StackMenu.Anchor      = Alignment.Fill;
            StackMenu.ChildAnchor = Alignment.MiddleFill;

            if (!string.IsNullOrWhiteSpace(form.Content))
            {
                StackMenu.AddMenuItem(form.Content, () => {}, false);
                StackMenu.AddSpacer();
            }

            var btns = form.Buttons.ToArray();

            for (var index = 0; index < btns.Length; index++)
            {
                var button = btns[index];
                int idx    = index;

                Action submitAction = () =>
                {
                    var packet = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = idx.ToString();
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                };

                if (button.Image != null)
                {
                    switch (button.Image.Type)
                    {
                    case "url":
                        StackMenu.AddChild(new FormImageButton(button.Image.Url, button.Text, submitAction));
                        continue;
                        break;

                    case "path":
                        break;
                    }
                }

                StackMenu.AddMenuItem(button.Text, submitAction);
            }

            Container.AddChild(StackMenu);

            Container.AddChild(new GuiTextElement()
            {
                Anchor    = Alignment.TopCenter,
                Text      = form.Title,
                FontStyle = FontStyle.Bold,
                Scale     = 2f,
                TextColor = TextColor.White
            });

            AddChild(Container);
        }
 public static IDisposable FormRoute(this HtmlHelper html, string routeName, FormMethod method, RouteValueDictionary valuesDictionary) {
     VirtualPathData virtualPath = RouteTable.Routes.GetVirtualPath(html.ViewContext, routeName, valuesDictionary);
     string formAction = (virtualPath == null) ? null : virtualPath.VirtualPath;
     SimpleForm form = new SimpleForm(html.ViewContext.HttpContext, formAction, method, null);
     form.WriteStartTag();
     return form;
 }
        public void BuyCoins(Player player)
        {
            var simpleForm = new SimpleForm();

            simpleForm.Title   = "Store - Buy coins";
            simpleForm.Content = "Select the amount of coins you want to buy.";
            simpleForm.Buttons = new List <Button>()
            {
                new Button {
                    Text = " 320 Coins -  $1.90", Image = new Image {
                        Type = "url", Url = "https://i.imgur.com/SedU2Ad.png"
                    }, ExecuteAction = ExecuteSelectPaymentMethod
                },
                new Button {
                    Text = "1032 Coins -  $4.95", Image = new Image {
                        Type = "url", Url = "https://i.imgur.com/oBMg5H3.png"
                    }, ExecuteAction = ExecuteSelectPaymentMethod
                },
                new Button {
                    Text = "3021 Coins - $10.05", Image = new Image {
                        Type = "url", Url = "https://i.imgur.com/hMAfqQd.png"
                    }, ExecuteAction = ExecuteSelectPaymentMethod
                },
                new Button {
                    Text = "Cancel"
                },
            };

            player.SendForm(simpleForm);
        }
Example #6
0
        public void ShowEndGameMenu(SkyPlayer player)
        {
            var simpleForm = new SimpleForm
            {
                Title   = GetGameModalTitle(),
                Content = GetEndOfGameContent(player),
                Buttons = new List <Button>
                {
                    new Button
                    {
                        Text = "§2§lPlay Again\n" +
                               "§r§8(Jump into a new game)",
                        Image = new Image
                        {
                            Type = "url",
                            Url  = "https://static.skytonia.com/dl/replayiconmenu.png"
                        },
                        ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, GameType); }
                    }
                }
            };

            StateType currentStateType = CurrentState.GetEnumState(this);

            if (currentStateType != StateType.EndGame &&
                currentStateType != StateType.Closing)
            {
                simpleForm.Buttons.Add(
                    new Button
                {
                    Text = "§6§lSpectate Game\n" +
                           "§r§8(Continue watching this game)",
                    Image = new Image
                    {
                        Type = "url",
                        Url  = "https://static.skytonia.com/dl/spectateiconmenu.png"
                    },
                    ExecuteAction = delegate { SetPlayerTeam(player, GetSpectatorTeam()); }
                }
                    );
            }

            simpleForm.Buttons.Add(
                new Button
            {
                Text = "§c§lChange Game\n" +
                       "§r§8(Choose a different game)",
                Image = new Image
                {
                    Type = "url",
                    Url  = "https://static.skytonia.com/dl/comingsooniconmenu.png"
                },
                ExecuteAction = delegate { GameUtil.ShowGameList(player); }
            }
                );

            player.SendForm(simpleForm);
        }
Example #7
0
        public static IDisposable FormRoute(this HtmlHelper html, string routeName, FormMethod method, RouteValueDictionary valuesDictionary)
        {
            VirtualPathData virtualPath = RouteTable.Routes.GetVirtualPath(html.ViewContext, routeName, valuesDictionary);
            string          formAction  = (virtualPath == null) ? null : virtualPath.VirtualPath;
            SimpleForm      form        = new SimpleForm(html.ViewContext.HttpContext, formAction, method, null);

            form.WriteStartTag();
            return(form);
        }
        /// <summary>
        /// 保存岗位责任书并将其状态设置成指定状态
        /// </summary>
        /// <param name="status">指定的状态</param>
        /// <returns></returns>
        private PostBook getPostBook()
        {
            PostBook pb = new PostBook();

            pb.EvaluatedID  = Request.QueryString["id"];
            pb.Employer     = Radio_Employer.SelectedValue;
            pb.LaborUnit    = Label_Depart.Text;
            pb.LaborDepart  = TextBox_LaborDepart.Text;
            pb.PostName     = Label_PostName.Text;
            pb.PostType     = Radio_PostType.SelectedValue;
            pb.EduBg        = TextArea_EduBg.Text;
            pb.Certificate  = TextArea_Certificate.Text;
            pb.Experience   = TextArea_Experience.Text;
            pb.Skill        = TextArea_Skill.Text;
            pb.Personality  = TextArea_Personality.Text;
            pb.PhyCond      = TextArea_PhyCond.Text;
            pb.WorkOutline  = TextArea_WorkOutline.Text;
            pb.Power        = TextArea_Power.Text;
            pb.Response     = TextArea_Response.Text;
            pb.DirectLeader = TextBox_DirectLeader.Text;
            pb.Subordinate  = TextBox_Subordinate.Text;
            pb.Colleague    = TextBox_Colleague.Text;
            pb.Services     = TextBox_Services.Text;
            pb.Relations    = TextBox_Relations.Text;
            pb.WorkEnter    = TextArea_WorkEnter.Text;
            pb.PostAssess   = TextArea_PostAssess.Text;
            pb.Others       = TextArea_Others.Text;

            pb.Comment = Label_Comment.Text;

            List <string[]> wcr = new List <string[]>();

            foreach (ControlBase item in Panel6.Items)
            {
                try
                {
                    SimpleForm sf  = item as SimpleForm;
                    TextArea   ta0 = sf.Items[0] as TextArea;
                    if (ta0.Text != "")             //填写了标题即认为填写了这一项
                    {
                        TextArea ta1     = sf.Items[1] as TextArea;
                        TextArea ta2     = sf.Items[2] as TextArea;
                        TextArea ta3     = sf.Items[3] as TextArea;
                        string[] content = new string[] { ta0.Text, ta1.Text, ta2.Text, ta3.Text };
                        wcr.Add(content);
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }
            pb.WorkContentRequest = wcr;

            return(pb);
        }
 /// <summary>
 /// 想页面中增加工作内容与要求的simpleform
 /// </summary>
 /// <param name="workContentRequest"></param>
 private void addWorkContentRequest(List <string[]> workContentRequest)
 {
     for (int i = 0; i < workContentRequest.Count; i++)
     {
         SimpleForm sf = Panel6.Items[i] as SimpleForm;
         sf.Collapsed = false;
         TextArea title   = sf.Items[0] as TextArea;
         TextArea content = sf.Items[1] as TextArea;
         TextArea request = sf.Items[2] as TextArea;
         TextArea point   = sf.Items[3] as TextArea;
         title.Text   = workContentRequest[i][0];
         content.Text = workContentRequest[i][1];
         request.Text = workContentRequest[i][2];
         point.Text   = workContentRequest[i][3];
     }
 }
 protected void Button_Clear_Click(object sender, EventArgs e)
 {
     TextBox_LaborDepart.Text  = "";
     Label_PostName.Text       = "";
     TextArea_EduBg.Text       = "";
     TextArea_Certificate.Text = "";
     TextArea_Experience.Text  = "";
     TextArea_Skill.Text       = "";
     TextArea_Personality.Text = "";
     TextArea_PhyCond.Text     = "";
     TextArea_WorkOutline.Text = "";
     TextArea_Power.Text       = "";
     TextArea_Response.Text    = "";
     TextBox_DirectLeader.Text = "";
     TextBox_Subordinate.Text  = "";
     TextBox_Colleague.Text    = "";
     TextBox_Services.Text     = "";
     TextBox_Relations.Text    = "";
     TextArea_WorkEnter.Text   = "";
     TextArea_PostAssess.Text  = "";
     TextArea_Others.Text      = "";
     foreach (ControlBase item in Panel6.Items)
     {
         try
         {
             SimpleForm sf  = item as SimpleForm;
             TextArea   ta0 = sf.Items[0] as TextArea;
             TextArea   ta1 = sf.Items[1] as TextArea;
             TextArea   ta2 = sf.Items[2] as TextArea;
             TextArea   ta3 = sf.Items[3] as TextArea;
             ta0.Text     = "";
             ta1.Text     = "";
             ta2.Text     = "";
             ta3.Text     = "";
             sf.Collapsed = true;
         }
         catch (Exception)
         {
             continue;
         }
     }
 }
        private void ExecutePayVisa(Player player, SimpleForm form)
        {
            CustomForm customForm = new CustomForm();

            customForm.Title         = "Secure Payment Info - VISA";
            customForm.ExecuteAction = ExecuteReviewOrder;
            customForm.Content       = new List <CustomElement>()
            {
                new Label {
                    Text = "Safe money transfer using your VISA card"
                },
                new Input {
                    Text = "", Placeholder = "Name - as it appears on card", Value = "John Doe"
                },
                new Input {
                    Text = "", Placeholder = "Credit card number", Value = "4242424242424242"
                },
                new Dropdown {
                    Text = "Expiration date (month)", Options = new List <string>()
                    {
                        "01 - January", "02 - February", "03 - March"
                    }, Value = 0
                },
                new Dropdown {
                    Text = "Expiration date (year)", Options = new List <string>()
                    {
                        "2017", "2018", "2019"
                    }, Value = 2
                },
                new Input {
                    Text = "", Placeholder = "Security code (3 on back)", Value = "111"
                },
                new Toggle {
                    Text = "Save payment info (safe)", Value = true
                },
                new Label {
                    Text = "§lWhat happens now?§r\nThis is step 1 of 2. After submitting payment information you will be able to review your order.\nWe will not bill you until confirm the order on next page (step 2)."
                },
            };

            player.SendForm(customForm);
        }
        /// <summary>
        /// 同步已选择的工作内容与要求到hiddenfield
        /// </summary>
        /// <returns></returns>
        private void syncSelectedWCR()
        {
            List <string> selectedWCR = new List <string>();

            foreach (ControlBase item in Panel3.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text == "")
                {
                    break;
                }
                FineUI.HiddenField hf    = sf.Items[2] as FineUI.HiddenField;
                string             title = hf.Text.Split('&')[0].Trim();
                selectedWCR.Add(title);
            }

            foreach (ControlBase item in Panel6.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text == "")
                {
                    break;
                }
                TextArea           ta    = sf.Items[1] as TextArea;
                FineUI.HiddenField hf    = sf.Items[2] as FineUI.HiddenField;
                string             title = hf.Text.Split('&')[0].Trim();
                selectedWCR.Add(title);
            }

            StringBuilder sb = new StringBuilder();

            foreach (string WCR in selectedWCR)
            {
                sb.Append(WCR + "$");
            }
            hfSelectedWCR.Text = sb.ToString();
        }
        public static void FieldsSettingFormOpen()
        {
            var frm = new CoreLib.Label.FieldsSettingsFrm()
            {
                MdiParent = MdiParentForm, WindowState = FormWindowState.Maximized
            };

            //Double click event
            frm.ObjectTree.DoubleClick += (s, e) =>
            {
                var treeList1 = (DevExpress.XtraTreeList.TreeList)s;
                DevExpress.XtraTreeList.TreeListHitInfo hi = treeList1.CalcHitInfo(treeList1.PointToClient(Control.MousePosition));
                if (hi.Node != null)
                {
                    var objType = hi.Node["ObjectType"] ?? "";
                    var objId   = hi.Node["Id"] ?? "";
                    var objName = hi.Node["Name"] ?? "";

                    if (objType.ToString() == "Table")
                    {
                        var  currObj = (CoreLib.Label.UIObjectBase)frm.UIObjectBaseXPC.Lookup(objId);
                        Args _args   = new Args()
                        {
                            ParmObject = currObj.ObjectType()
                        };
                        SimpleForm simpleFrm = new SimpleForm(_args)
                        {
                            WindowState = FormWindowState.Maximized,
                            Text        = currObj.ObjectName
                        };
                        simpleFrm.ShowDialog();
                    }
                }
            };

            frm.Show();
        }
        /// <summary>
        /// 载入考核表
        /// </summary>
        private void loadEvaluateTable(string id)
        {
            string evaluatedID = "";

            if (id == "" || id == "0")
            {
                evaluatedID = Request.QueryString["id"];
            }
            else
            {
                evaluatedID = id;
            }
            Panel1.Title = Request.QueryString["name"] + "的考核表";
            EvaluateTable evaluateTable = new EvaluateTable();
            string        exception     = "";

            if (EvaluateTableManagementCtrl.GetEvaluateTable(evaluatedID, ref evaluateTable, ref exception))
            {
                Label_Comment.Text = evaluateTable.Comment;

                Label_EvaluatedName.Text = evaluateTable.EvaluatedName;
                Label_PostName.Text      = evaluateTable.PostName;
                Label_LaborDep.Text      = evaluateTable.LaborDep;
                Label_LaborUnit.Text     = evaluateTable.LaborUnit;
                Label_Period.Text        = evaluateTable.StartTime + " ~ " + evaluateTable.StopTime;

                for (int i = 0; i < evaluateTable.KeyResponse.Count; i++)
                {
                    SimpleForm sf = Panel3.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox         tb = sf.Items[0] as TriggerBox;
                    TextArea           ta = sf.Items[1] as TextArea;
                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    tb.Text = evaluateTable.KeyResponse[i].Title;
                    ta.Text = evaluateTable.KeyResponse[i].Content[0];
                    hf.Text = evaluateTable.KeyResponse[i].Title + "&" + evaluateTable.KeyResponse[i].Content[0];
                }

                for (int i = 0; i < evaluateTable.KeyQualify.Count; i++)
                {
                    SimpleForm sf = Panel4.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.KeyQualify[i].Title;
                    ta.Text = "优:" + evaluateTable.KeyQualify[i].Content[0]
                              + " 良:" + evaluateTable.KeyQualify[i].Content[1]
                              + " 中:" + evaluateTable.KeyQualify[i].Content[2]
                              + " 差:" + evaluateTable.KeyQualify[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.KeyQualify[i].Title
                              + "&" + evaluateTable.KeyQualify[i].Content[0]
                              + "^" + evaluateTable.KeyQualify[i].Content[1]
                              + "^" + evaluateTable.KeyQualify[i].Content[2]
                              + "^" + evaluateTable.KeyQualify[i].Content[3];
                }

                for (int i = 0; i < evaluateTable.KeyAttitude.Count; i++)
                {
                    SimpleForm sf = Panel5.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.KeyAttitude[i].Title;
                    ta.Text = "优:" + evaluateTable.KeyAttitude[i].Content[0]
                              + " 良:" + evaluateTable.KeyAttitude[i].Content[1]
                              + " 中:" + evaluateTable.KeyAttitude[i].Content[2]
                              + " 差:" + evaluateTable.KeyAttitude[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.KeyAttitude[i].Title
                              + "&" + evaluateTable.KeyAttitude[i].Content[0]
                              + "^" + evaluateTable.KeyAttitude[i].Content[1]
                              + "^" + evaluateTable.KeyAttitude[i].Content[2]
                              + "^" + evaluateTable.KeyAttitude[i].Content[3];
                }

                for (int i = 0; i < evaluateTable.Response.Count; i++)
                {
                    SimpleForm sf = Panel6.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox         tb = sf.Items[0] as TriggerBox;
                    TextArea           ta = sf.Items[1] as TextArea;
                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    tb.Text = evaluateTable.Response[i].Title;
                    ta.Text = evaluateTable.Response[i].Content[0];
                    hf.Text = evaluateTable.Response[i].Title + "&" + evaluateTable.Response[i].Content[0];
                }

                for (int i = 0; i < evaluateTable.Qualify.Count; i++)
                {
                    SimpleForm sf = Panel7.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.Qualify[i].Title;
                    ta.Text = "优:" + evaluateTable.Qualify[i].Content[0]
                              + " 良:" + evaluateTable.Qualify[i].Content[1]
                              + " 中:" + evaluateTable.Qualify[i].Content[2]
                              + " 差:" + evaluateTable.Qualify[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.Qualify[i].Title
                              + "&" + evaluateTable.Qualify[i].Content[0]
                              + "^" + evaluateTable.Qualify[i].Content[1]
                              + "^" + evaluateTable.Qualify[i].Content[2]
                              + "^" + evaluateTable.Qualify[i].Content[3];
                }

                for (int i = 0; i < evaluateTable.Attitude.Count; i++)
                {
                    SimpleForm sf = Panel8.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.Attitude[i].Title;
                    ta.Text = "优:" + evaluateTable.Attitude[i].Content[0]
                              + " 良:" + evaluateTable.Attitude[i].Content[1]
                              + " 中:" + evaluateTable.Attitude[i].Content[2]
                              + " 差:" + evaluateTable.Attitude[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.Attitude[i].Title
                              + "&" + evaluateTable.Attitude[i].Content[0]
                              + "^" + evaluateTable.Attitude[i].Content[1]
                              + "^" + evaluateTable.Attitude[i].Content[2]
                              + "^" + evaluateTable.Attitude[i].Content[3];
                }

                TextArea_Reject1.Text = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
                TextArea_Reject2.Text = evaluateTable.Reject[0].Content[0];
            }
            else    //如果该被考评人的岗位责任书尚未制定,则被考评人姓名、岗位名称、用工部门、用工单位和考核时间段从父网页获取
            {
                Label_EvaluatedName.Text = Request.QueryString["name"];
                Label_PostName.Text      = Request.QueryString["postname"];
                Label_LaborDep.Text      = Request.QueryString["labordepart"];
                Label_LaborUnit.Text     = Request.QueryString["depart"];
                Label_Period.Text        = Request.QueryString["starttime"] + " ~ " + Request.QueryString["stoptime"];
                TextArea_Reject1.Text    = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
            }
        }
        private void loadEvaluateTable()
        {
            string exception   = "";
            string evaluatedID = Request.QueryString["id"];
            string name        = Request.QueryString["name"];

            Panel1.Title = name + "的考核表";
            EvaluateTable evaluateTable = new EvaluateTable();

            if (EvaluateTableManagementCtrl.GetEvaluateTable(evaluatedID, ref evaluateTable, ref exception))
            {
                Label_EvaluatedName.Text = evaluateTable.EvaluatedName;
                Label_PostName.Text      = evaluateTable.PostName;
                Label_LaborDep.Text      = evaluateTable.LaborDep;
                Label_LaborUnit.Text     = evaluateTable.LaborUnit;
                Label_Period.Text        = evaluateTable.StartTime + " ~ " + evaluateTable.StopTime;

                int count = 1;
                foreach (Quota item in evaluateTable.KeyResponse)
                {
                    SimpleForm sf = new SimpleForm();
                    sf.ID          = "SimpleForm_KeyResponse_" + count;
                    sf.ShowHeader  = false;
                    sf.ShowBorder  = true;
                    sf.BodyPadding = "5px";
                    FineUI.TextBox tb = new FineUI.TextBox();
                    tb.ID       = "TextBox_KeyResponse_" + count;
                    tb.Label    = "标题";
                    tb.Text     = item.Title;
                    tb.Readonly = true;
                    sf.Items.Add(tb);
                    FineUI.TextArea ta = new FineUI.TextArea();
                    ta.ID       = "TextArea_KeyResponse_" + count;
                    ta.Label    = "内容";
                    ta.Text     = item.Content[0];
                    ta.Readonly = true;
                    sf.Items.Add(ta);
                    Panel3.Items.Add(sf);
                    count++;
                }

                count = 1;
                foreach (Quota item in evaluateTable.KeyQualify)
                {
                    SimpleForm sf = new SimpleForm();
                    sf.ID          = "SimpleForm_KeyQualify_" + count;
                    sf.ShowHeader  = false;
                    sf.ShowBorder  = true;
                    sf.BodyPadding = "5px";
                    FineUI.TextBox tb = new FineUI.TextBox();
                    tb.ID       = "TextBox_KeyQualify_" + count;
                    tb.Label    = "标题";
                    tb.Text     = item.Title;
                    tb.Readonly = true;
                    sf.Items.Add(tb);
                    FineUI.TextArea ta = new FineUI.TextArea();
                    ta.ID    = "TextArea_KeyQualify_" + count;
                    ta.Label = "内容";
                    ta.Text  = "优:" + item.Content[0]
                               + "良:" + item.Content[1]
                               + "中:" + item.Content[2]
                               + "差:" + item.Content[3];
                    ta.Readonly = true;
                    sf.Items.Add(ta);
                    Panel4.Items.Add(sf);
                    count++;
                }

                count = 1;
                foreach (Quota item in evaluateTable.KeyAttitude)
                {
                    SimpleForm sf = new SimpleForm();
                    sf.ID          = "SimpleForm_KeyAttitude_" + count;
                    sf.ShowHeader  = false;
                    sf.ShowBorder  = true;
                    sf.BodyPadding = "5px";
                    FineUI.TextBox tb = new FineUI.TextBox();
                    tb.ID       = "TextBox_KeyAttitude_" + count;
                    tb.Label    = "标题";
                    tb.Text     = item.Title;
                    tb.Readonly = true;
                    sf.Items.Add(tb);
                    FineUI.TextArea ta = new FineUI.TextArea();
                    ta.ID    = "TextArea_KeyAttitude_" + count;
                    ta.Label = "内容";
                    ta.Text  = "优:" + item.Content[0]
                               + "良:" + item.Content[1]
                               + "中:" + item.Content[2]
                               + "差:" + item.Content[3];
                    ta.Readonly = true;
                    sf.Items.Add(ta);
                    Panel5.Items.Add(sf);
                    count++;
                }

                count = 1;
                foreach (Quota item in evaluateTable.Response)
                {
                    SimpleForm sf = new SimpleForm();
                    sf.ID          = "SimpleForm_Response_" + count;
                    sf.ShowHeader  = false;
                    sf.ShowBorder  = true;
                    sf.BodyPadding = "5px";
                    FineUI.TextBox tb = new FineUI.TextBox();
                    tb.ID       = "TextBox_Response_" + count;
                    tb.Label    = "标题";
                    tb.Text     = item.Title;
                    tb.Readonly = true;
                    sf.Items.Add(tb);
                    FineUI.TextArea ta = new FineUI.TextArea();
                    ta.ID       = "TextArea_Response_" + count;
                    ta.Label    = "内容";
                    ta.Text     = item.Content[0];
                    ta.Readonly = true;
                    sf.Items.Add(ta);
                    Panel6.Items.Add(sf);
                    count++;
                }

                count = 1;
                foreach (Quota item in evaluateTable.Qualify)
                {
                    SimpleForm sf = new SimpleForm();
                    sf.ID          = "SimpleForm_Qualify_" + count;
                    sf.ShowHeader  = false;
                    sf.ShowBorder  = true;
                    sf.BodyPadding = "5px";
                    FineUI.TextBox tb = new FineUI.TextBox();
                    tb.ID       = "TextBox_Qualify_" + count;
                    tb.Label    = "标题";
                    tb.Text     = item.Title;
                    tb.Readonly = true;
                    sf.Items.Add(tb);
                    FineUI.TextArea ta = new FineUI.TextArea();
                    ta.ID    = "TextArea_Qualify_" + count;
                    ta.Label = "内容";
                    ta.Text  = "优:" + item.Content[0]
                               + "良:" + item.Content[1]
                               + "中:" + item.Content[2]
                               + "差:" + item.Content[3];
                    ta.Readonly = true;
                    sf.Items.Add(ta);
                    Panel7.Items.Add(sf);
                    count++;
                }

                count = 1;
                foreach (Quota item in evaluateTable.Attitude)
                {
                    SimpleForm sf = new SimpleForm();
                    sf.ID          = "SimpleForm_Attitude_" + count;
                    sf.ShowHeader  = false;
                    sf.ShowBorder  = true;
                    sf.BodyPadding = "5px";
                    FineUI.TextBox tb = new FineUI.TextBox();
                    tb.ID       = "TextBox_Attitude_" + count;
                    tb.Label    = "标题";
                    tb.Text     = item.Title;
                    tb.Readonly = true;
                    sf.Items.Add(tb);
                    FineUI.TextArea ta = new FineUI.TextArea();
                    ta.ID    = "TextArea_Attitude_" + count;
                    ta.Label = "内容";
                    ta.Text  = "优:" + item.Content[0]
                               + "良:" + item.Content[1]
                               + "中:" + item.Content[2]
                               + "差:" + item.Content[3];
                    ta.Readonly = true;
                    sf.Items.Add(ta);
                    Panel8.Items.Add(sf);
                    count++;
                }

                SimpleForm sf__reject = new SimpleForm();
                sf__reject.ID          = "SimpleForm_Reject";
                sf__reject.ShowBorder  = true;
                sf__reject.ShowHeader  = false;
                sf__reject.BodyPadding = "5px";
                TextArea ta1 = new TextArea();
                ta1.Label = "严重违反规章制度";
                ta1.Text  = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
                TextArea ta2 = new TextArea();
                ta2.Label    = "其他";
                ta2.Text     = evaluateTable.Reject[0].Content[0];
                ta1.Readonly = true;
                ta2.Readonly = true;
                sf__reject.Items.Add(ta1);
                sf__reject.Items.Add(ta2);
                Panel9.Items.Add(sf__reject);

                Label_Comment.Text = evaluateTable.Comment;
            }
            else
            {
                Alert.ShowInTop("未查寻到考核表!\n原因:" + exception, MessageBoxIcon.Error);
            }
        }
Example #16
0
        public SimpleFormDialog(uint formId, BedrockFormManager parent, SimpleForm form, InputManager inputManager) : base(formId, parent, inputManager)
        {
            StackMenu             = new GuiStackMenu();
            StackMenu.Anchor      = Alignment.Fill;
            StackMenu.ChildAnchor = Alignment.MiddleCenter;
            StackMenu.Background  = Color.Black * 0.35f;

            if (!string.IsNullOrWhiteSpace(form.Content))
            {
                StackMenu.AddLabel(FixContrast(form.Content));
                StackMenu.AddSpacer();
            }

            var btns = form.Buttons.ToArray();

            for (var index = 0; index < btns.Length; index++)
            {
                var button = btns[index];
                int idx    = index;

                Action submitAction = () =>
                {
                    var packet = McpeModalFormResponse.CreateObject();
                    packet.formId = formId;
                    packet.data   = idx.ToString();
                    //JsonConvert.SerializeObject(idx)
                    parent.SendResponse(packet);

                    parent.Hide(formId);
                };

                if (button.Image != null)
                {
                    switch (button.Image.Type)
                    {
                    case "url":
                        StackMenu.AddChild(new FormImageButton(button.Image.Url, button.Text, submitAction));
                        continue;
                        break;

                    case "path":
                        break;
                    }
                }

                var item = StackMenu.AddMenuItem(button.Text, submitAction);
            }

            Background = Color.Transparent;

            var width  = 356;
            var height = width;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = width;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = height;

            SetFixedSize(width, height);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            Container.Anchor = Alignment.MiddleCenter;

            var bodyWrapper = new GuiContainer();

            bodyWrapper.Anchor  = Alignment.Fill;
            bodyWrapper.Padding = new Thickness(5, 0);
            bodyWrapper.AddChild(StackMenu);

            Container.AddChild(bodyWrapper);

            Container.AddChild(Header = new GuiStackContainer()
            {
                Anchor      = Alignment.TopFill,
                ChildAnchor = Alignment.BottomCenter,
                Height      = 32,
                Padding     = new Thickness(3),
                Background  = Color.Black * 0.5f
            });

            Header.AddChild(new GuiTextElement()
            {
                Text      = FixContrast(form.Title),
                TextColor = TextColor.White,
                Scale     = 2f,
                FontStyle = FontStyle.DropShadow,

                Anchor = Alignment.BottomCenter,
            });

            StackMenu.Margin = new Thickness(0, Header.Height, 0, 0);
        }
Example #17
0
 private static async Task <bool> DefinitionMethod(SimpleForm state, Field <SimpleForm> field)
 {
     field.SetPrompt(new PromptAttribute($"You chose a rating of {state.Rating}. What is your name?."));
     return(true);
 }
        /// <summary>
        /// 清空所有项目
        /// </summary>
        private void clearAll()
        {
            Label_Period.Text = "";

            foreach (ControlBase cb in Panel3.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel4.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel5.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel6.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel7.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel8.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            TextArea_Reject1.Text = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
            TextArea_Reject2.Text = "";
        }
        public void a_basic_test()
        {
            var registry = new FubuRegistry(x =>
            {
                x.HtmlConvention<DefaultHtmlConventions>();
            });
            var container = new Container();

            FubuApplication.For(registry).StructureMap(container).Bootstrap();

            var tags = container.GetInstance<TagGenerator<AddressViewModel>>();
            tags.Model = new AddressViewModel()
                             {
                                 ShouldShow = true
                             };

            var form = new SimpleForm<AddressViewModel, DefinitionListLabelAndField>(tags);
            theRenderedFormLine = form.Display(p => p.ShouldShow);

            var xx = theRenderedFormLine.Render();

            xx.ShouldContain(tags.LabelFor(x=>x.ShouldShow).ToString());
            xx.ShouldContain(tags.DisplayFor(x=>x.ShouldShow).ToString());
        }
        /// <summary>
        /// 同步已选择的指标到hiddenfield
        /// </summary>
        private void syncSelectedQuota()
        {
            List <string> selectedQuota = new List <string>();

            foreach (ControlBase item in Panel4.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf    = sf.Items[2] as FineUI.HiddenField;
                string             title = hf.Text.Split('&')[0].Trim();
                selectedQuota.Add(title);
            }
            foreach (ControlBase item in Panel5.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf    = sf.Items[2] as FineUI.HiddenField;
                string             title = hf.Text.Split('&')[0].Trim();
                selectedQuota.Add(title);
            }
            foreach (ControlBase item in Panel7.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf    = sf.Items[2] as FineUI.HiddenField;
                string             title = hf.Text.Split('&')[0].Trim();
                selectedQuota.Add(title);
            }
            foreach (ControlBase item in Panel8.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf    = sf.Items[2] as FineUI.HiddenField;
                string             title = hf.Text.Split('&')[0].Trim();
                selectedQuota.Add(title);
            }

            StringBuilder sb = new StringBuilder();

            foreach (string quota in selectedQuota)
            {
                sb.Append(quota + "$");
            }
            hfSelectedQuota.Text = sb.ToString();
        }
Example #21
0
 public View PostAnswer(SimpleForm form)
 {
     Answers.Add(form.Answer);
     // todo make redirect
     return(Index());
 }
Example #22
0
        public static void ShowGameList(SkyPlayer player)
        {
            try
            {
                if (player == null || !player.IsConnected || player.KnownPosition == null)
                {
                    SkyUtil.log("Attempted to show GameList to a null player");
                    return;
                }

                var simpleForm = new SimpleForm
                {
                    Title   = "§lSkytonia Network",
                    Content = "",
                    Buttons = new List <Button>
                    {
                        new Button
                        {
                            Text  = $"§3§lNetwork Lobby\n{GetFormattedPlayerCount("hub")}",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/hubiconmenu.png"
                            },
                            ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, "hub"); }
                        },
                        new Button
                        {
                            Text  = $"§c§lMurder Mystery\n{GetFormattedPlayerCount("murder")}",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/murdericonmenu.png"
                            },
                            ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, "murder"); }
                        },
                        new Button
                        {
                            Text  = $"§6§l Build Battle\n{GetFormattedPlayerCount("build-battle")}",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/buildbattleiconmenu.png"
                            },
                            ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, "build-battle"); }
                        },
                        new Button
                        {
                            Text  = $"§d§lComing Soon...",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/comingsooniconmenu.png"
                            },
                            ExecuteAction = delegate {  }                             //Empty
                        }
                    }
                };

                player.SendForm(simpleForm);
            }
            catch (Exception e)
            {
                BugSnagUtil.ReportBug(e);
            }
        }
        /// <summary>
        /// 获取当前页面中的考核表
        /// </summary>
        /// <returns></returns>
        private EvaluateTable getNewEvaluateTable()
        {
            EvaluateTable evaluateTable = new EvaluateTable();

            evaluateTable.EvaluatedName = Label_EvaluatedName.Text.Trim();
            evaluateTable.PostName      = Label_PostName.Text.Trim();
            evaluateTable.LaborDep      = Label_LaborDep.Text.Trim();
            evaluateTable.LaborUnit     = Label_LaborUnit.Text.Trim();
            evaluateTable.StartTime     = Label_Period.Text.Split('~')[0].Trim();
            evaluateTable.StopTime      = Label_Period.Text.Split('~')[1].Trim();
            foreach (ControlBase item in Panel3.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = new string[] { hf.Text.Split('&')[1] };
                evaluateTable.KeyResponse.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel4.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.KeyQualify.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel5.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.KeyAttitude.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel6.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text == "")
                {
                    break;
                }
                TextArea           ta      = sf.Items[1] as TextArea;
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = new string[] { hf.Text.Split('&')[1] };
                evaluateTable.Response.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel7.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.Qualify.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel8.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.Attitude.Add(new Quota(title, content));
            }

            evaluateTable.Reject.Add(new Quota("其他", new string[] { TextArea_Reject2.Text.Trim() }));

            return(evaluateTable);
        }