示例#1
0
        public GroupData(IDictionary <string, object> groupInfo, RuleInfo parent)
        {
            RowDatas = new List <RowData>();
            Name     = groupInfo.ContainsKey("name") ? groupInfo["name"].ToString() : "";
            if (groupInfo.ContainsKey("cellwidth"))
            {
                float.TryParse(groupInfo["cellwidth"].ToString(), out CellWidth);
            }
            if (groupInfo.ContainsKey("cellheight"))
            {
                float.TryParse(groupInfo["cellheight"].ToString(), out CellHeight);
            }
            if (groupInfo.ContainsKey("namewidth"))
            {
                int.TryParse(groupInfo["namewidth"].ToString(), out NameWidth);
            }
            OffY   = groupInfo.ContainsKey("offy") ? float.Parse(groupInfo["offy"].ToString()) : 10;
            Parent = parent;
            if (!groupInfo.ContainsKey("rows"))
            {
                return;
            }
            var rows = groupInfo["rows"] as List <object>;

            if (rows == null)
            {
                return;
            }
            foreach (var row in rows)
            {
                var rowInfo = row as Dictionary <string, object>;
                if (rowInfo == null)
                {
                    continue;
                }
                var rowData = new RowData(rowInfo, Parent);
                RowDatas.Add(rowData);
            }
        }
示例#2
0
        public GroupData(KeyValuePair <string, object> groups, RuleInfo parent)
        {
            RowDatas = new List <RowData>();
            Name     = groups.Key;
            Parent   = parent;
            var rowlist = groups.Value as List <object>;

            if (rowlist == null)
            {
                return;
            }
            foreach (var row in rowlist)
            {
                var rowInfo = row as List <object>;
                if (rowInfo == null)
                {
                    continue;
                }
                var rowData = new RowData(rowInfo, Parent);
                RowDatas.Add(rowData);
            }
        }