Ejemplo n.º 1
0
        public RowData(IDictionary <string, object> rowInfo, RuleInfo parent)
        {
            Items  = new List <ItemData>();
            Parent = parent;
            if (rowInfo == null)
            {
                Items = null;
                return;
            }
            if (rowInfo.ContainsKey("spacing"))
            {
                var temp = rowInfo["spacing"];
                if (temp != null)
                {
                    float.TryParse(rowInfo["spacing"].ToString(), out Spacing);
                }
            }

            if (!rowInfo.ContainsKey("item"))
            {
                return;
            }
            var row = rowInfo["item"] as List <object>;

            if (row == null)
            {
                return;
            }
            var len = row.Count;

            for (var i = 0; i < len; i++)
            {
                var item     = row[i];
                var itemData = new ItemData(i, item, Parent);
                if (itemData.ShowType < 0)
                {
                    continue;
                }
                Items.Add(itemData);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        public RowData(IList <object> rowInfo, RuleInfo parent)
        {
            Items  = new List <ItemData>();
            Parent = parent;
            if (rowInfo == null)
            {
                Items = null;
                return;
            }
            var len = rowInfo.Count;

            for (var i = 0; i < len; i++)
            {
                var item     = rowInfo[i];
                var itemData = new ItemData(i, item, Parent);
                if (itemData.ShowType < 0)
                {
                    continue;
                }
                Items.Add(itemData);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        public ItemData(int index, object item, RuleInfo parent)
        {
            Parent = parent;
            Index  = index;
            var itemDict = item as Dictionary <string, object>;

            if (itemDict == null)
            {
                Id      = "";
                Name    = "";
                Type    = RuleItemType.none;
                Key     = "";
                State   = false;
                Value   = "";
                Width   = 0;
                Height  = 0;
                UseItem = "";
                UseNum  = 0;
                Group   = 0;
                Dp      = null;
                Ep      = null;
                Rp      = null;
                Tip     = "";
                return;
            }
            Id       = itemDict.ContainsKey("id") ? itemDict["id"].ToString() : "";
            Name     = itemDict.ContainsKey("name") ? itemDict["name"].ToString() : "";
            Key      = itemDict.ContainsKey("key") ? itemDict["key"].ToString() : "";
            State    = itemDict.ContainsKey("state") && bool.Parse(itemDict["state"].ToString());
            Value    = itemDict.ContainsKey("value") ? itemDict["value"].ToString() : "";
            Width    = itemDict.ContainsKey("width") ? int.Parse(itemDict["width"].ToString()) : 0;
            Height   = itemDict.ContainsKey("height") ? int.Parse(itemDict["height"].ToString()) : 0;
            UseItem  = itemDict.ContainsKey("useitem") ? itemDict["useitem"].ToString() : "";
            UseNum   = itemDict.ContainsKey("usenum") ? int.Parse(itemDict["usenum"].ToString()) : 0;
            Group    = itemDict.ContainsKey("group") ? int.Parse(itemDict["group"].ToString()) : 0;
            Dp       = itemDict.ContainsKey("dp") ? itemDict["dp"].ToString().Split(',') : new string[0];
            Ep       = itemDict.ContainsKey("ep") ? itemDict["ep"].ToString().Split(',') : new string[0];
            Rp       = itemDict.ContainsKey("rp") ? itemDict["rp"].ToString().Split(',') : new string[0];
            ShowType = itemDict.ContainsKey("showtype") ? int.Parse(itemDict["showtype"].ToString()) : 0;
            Type     = itemDict.ContainsKey("type") ? (RuleItemType)Enum.Parse(typeof(RuleItemType), itemDict["type"].ToString()) : RuleItemType.none;
            Tip      = itemDict.ContainsKey("tip") ? itemDict["tip"].ToString() : "";

            if (itemDict.ContainsKey("hide"))
            {
                parent.Tabs[Id] = itemDict["hide"].ToString().Split(',');
            }
            if (Type != RuleItemType.none)
            {
                parent.CreateArgs[Id] = this;
                if (Type == RuleItemType.button)
                {
                    var tabIndex = parent.TabDefaultIndex;
                    if (tabIndex > -1 ? tabIndex == Index : State)
                    {
                        parent.CurTabItemId = Id;
                    }
                }
                else
                {
                    State = RuleInfo.GetItemState(parent.CurTabItemId, Id, State);
                }
            }
            if (itemDict.ContainsKey("clicktype"))
            {
                var info  = itemDict["clicktype"].ToString();
                var infos = info.Split('|');
                if (infos.Length > 0)
                {
                    ClickType = new ClickTypeData
                    {
                        Type = (ECLickType)Enum.Parse(typeof(ECLickType), infos[0]),
                        Parm = infos.Length > 1 ? infos[1].Split(','):new string[0]
                    };
                }
            }
        }