Beispiel #1
0
        protected override void FillCore(SealedControl obj, HtmlNode node, HtmlNode coreNode, PageBrush brush)
        {
            var name   = node.GetAttributeValue("name", string.Empty);
            var select = node.GetAttributeValue("select", string.Empty);

            brush.DrawLine("<table class=\"input-tags-table\">");
            brush.DrawLine("<tr>");
            brush.DrawLine("<td class=\"input-tags-container\">");
            FillControl(node, coreNode, brush);
            brush.DrawLine("</td>");
            brush.DrawLine("<td class=\"input-tags-btnContainer\">");

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(select))
            {
                var invokeCode = ProxyCodeExtend.GetScriptEventCode(obj, node, "select:click");
                brush.DrawLine("<button class=\"btn blue\" data-name=\"select\" data-proxy=\"{" + invokeCode + "}\"><i class=\"fa fa-plus\"></i> 选择</button>");
            }
            else
            {
                obj.Elements.Render(brush, "<m:button data-name=\"select\" color=\"blue\"><m:Icon src=\"plus\"></m:Icon>选择</m:button>");
            }
            brush.DrawLine("</td>");
            brush.DrawLine("<td class=\"input-tags-btnContainer\">");
            obj.Elements.Render(brush, "<m:button data-name=\"reset\" color=\"purple\"><m:Icon src=\"times\"></m:Icon>清除</m:button>");
            brush.DrawLine("</td>");
            brush.DrawLine("</tr>");
            brush.DrawLine("</table>");
        }
        public static void OutputAttribute(CustomAttribute attr, StringBuilder code)
        {
            switch (attr.Name)
            {
            case "view": code.AppendFormat(" data-view=\"{0}\"", ProxyCodeExtend.TidyView(attr.GetPrintValue())); break;

            case "form": code.AppendFormat(" data-form=\"{0}\"", attr.GetPrintValue()); break;

            default:
                code.AppendFormat(" {0}=\"{1}\"", attr.Name, attr.GetPrintValue());
                break;
            }
        }
        public static void OutputAttribute(CustomAttribute attr, PageBrush brush)
        {
            switch (attr.Name)
            {
            case "view": brush.DrawFormat(" data-view=\"{0}\"", ProxyCodeExtend.TidyView(attr.GetPrintValue())); break;

            case "form": brush.DrawFormat(" data-form=\"{0}\"", attr.GetPrintValue()); break;

            default:
                brush.DrawFormat(" {0}=\"{1}\"", attr.Name, attr.GetPrintValue());
                break;
            }
        }
Beispiel #4
0
        public static string GetProxyCode(UIElement e, HtmlNode node, string giveCode, string uiParasCode, string membersCode)
        {
            StringBuilder code = new StringBuilder("{");

            code.AppendFormat("give:{0}", giveCode);
            code.Append(",'" + node.LocalName() + "':true,uiParas:{");
            code.Append(uiParasCode);
            code.Append("}");
            if (!string.IsNullOrEmpty(membersCode))
            {
                code.AppendFormat(",{0}", membersCode);
            }
            code.Append("}");
            var proxyCode = code.ToString();

            ProxyCodeExtend.TryFillCode(e, node, ref proxyCode);
            return(proxyCode);
        }