Exemplo n.º 1
0
        private void PowerFliter(LibHandle handle, ref string data)
        {
            MenuTree obj = JsonConvert.DeserializeObject(data, typeof(MenuTree)) as MenuTree;

            if (obj != null)
            {
                var childrenList = obj.children;
                if (childrenList != null && childrenList.Count > 0)
                {
                    for (int i = childrenList.Count - 1; i >= 0; i--)
                    {
                        PowerControl(handle, childrenList, childrenList[i]);
                    }
                    data = JsonConvert.SerializeObject(obj);
                }
            }
        }
Exemplo n.º 2
0
        private void PowerControl(LibHandle handle, List <MenuTree> list, MenuTree subObj)
        {
            var childrenList = subObj.children;

            if (childrenList != null && childrenList.Count > 0)
            {
                for (int i = childrenList.Count - 1; i >= 0; i--)
                {
                    PowerControl(handle, childrenList, childrenList[i]);
                }
            }
            else if (!string.IsNullOrEmpty(subObj.PROGID))
            {
                if (!LibPermissionControl.Default.CanUse(handle, subObj.PROGID))
                {
                    list.Remove(subObj);
                }
            }
        }