Exemplo n.º 1
0
 void Append()
 {
     if (data.Count > 0 || dataText.Length > 0)
     {
         if (dataText.Length > 0)
         {
             data.Put("m" + data.Count.ToString(), dataText.ToString());
         }
         dataText = new StringBuilder();
         var sb = new StringBuilder();
         for (int i = 0; i < data.Count; i++)
         {
             sb.Append("{m");
             sb.Append(i);
             sb.Append("}");
         }
         var cell = UICell.Create(data["type"] ?? "CMSText", data);
         data.Remove("type");
         cell.Format.Put("text", sb.ToString());
         cell.Style.Copy(style);
         cells.Add(cell);
         data  = new WebMeta();
         style = new UIStyle();
     }
 }
Exemplo n.º 2
0
        UIImageTitleDescBottom TitleDesc(WebMeta config, Design_Item item, String img, UMC.Data.WebResource webr)
        {
            //WebMeta data = Utility.isNull(UMC.Data.JSON.deserialize(item.Data, WebMeta.class), new UMC.Web.WebMeta());
            WebMeta data = UMC.Data.JSON.Deserialize <WebMeta>(item.Data) ?? new UMC.Web.WebMeta();

            int    m    = 0;
            String hide = config.Get("Hide") ?? "";

            if (hide.Contains("HideTitle"))
            {
                m |= 1;
                data.Remove("title");
            }
            if (hide.Contains("HideDesc"))
            {
                m |= 2;
                data.Remove("desc");
            }
            if (hide.Contains("HideLeft"))
            {
                m |= 4;
                data.Remove("left");
            }
            if (hide.Contains("HideRight"))
            {
                m |= 8;
                data.Remove("right");
            }
            data.Put("show", m);
            String src = (String.Format("{0}!{1}?{2}", webr.ImageResolve(item.Id.Value, "1", 0), img, TimeSpan(item.ModifiedDate)));
            //        list.add(slider);

            //
            UIImageTitleDescBottom btm = new UIImageTitleDescBottom(data, src);

            btm.Click(this.Click(item));
            var left = data["left"];

            if (String.IsNullOrEmpty(left) == false)
            {
                var p = @"\d+\.?\d{0,2}";
                int i = -1;
                var t = System.Text.RegularExpressions.Regex.Replace(left, p, dr =>
                {
                    i++;
                    switch (i)
                    {
                    case 0:
                        data.Put("price", dr.Value);
                        return("¥{1:price} ");

                    case 1:
                        data.Put("orgin", dr.Value);
                        return(" {orgin}");
                    }
                    return(dr.Value);
                }, System.Text.RegularExpressions.RegexOptions.Multiline);
                btm.Left(t);
                btm.Style.Name("price", new UIStyle().Size(16).Color(0xdb3652)).Name("unit", new UIStyle().Size(12).Color(0x999)).Name("orgin", new UIStyle().Color(0x999).Size(12).DelLine());
            }

            ;
            return(btm);
        }