Exemple #1
0
        public async Task <List <CNode> > GetNavigatorNodes_TreeNodes(CWorkingLayer layer, string lcid, string target, string viewstate)
        {
            var content = await communicationManager.GetNavigatorNodes_TreeNodes(m_Url, layer, target, lcid, viewstate, m_Session.Id, serverName);

            if (content == null)
            {
                return(null);
            }
            JArray       jarray = JArray.Parse(content);
            List <CNode> result = new List <CNode>();

            if (jarray == null)
            {
                return(result);
            }

            foreach (var token in jarray)
            {
                var   item = token.SelectToken("Item");
                CNode o    = new CNode()
                {
                    Item = new CObject()
                    {
                        ClassType       = item.SelectToken("ClassType").Value <string>(),
                        Description     = item.SelectToken("Description").Value <string>(),
                        IsClientPicture = item.SelectToken("IsClientPicture").Value <bool>(),
                        Picture         = item.SelectToken("Picture").Value <string>(),
                        Name            = item.SelectToken("Name").Value <string>(),
                        OverlayUID      = item.SelectToken("OverlayUID").Value <string>(),
                        ProjectUID      = item.SelectToken("ProjectUID").Value <string>(),
                        UID             = item.SelectToken("UID").Value <string>(),
                        SystemFullName  = item.SelectToken("SystemFullName").Value <string>()
                    }
                };
                if (o.Item.OverlayUID == null)
                {
                    o.Item.OverlayUID = layer.UID;
                }
                if (o.Item.ProjectUID == null)
                {
                    o.Item.ProjectUID = layer.ProjectUID;
                }
                List <CObject> Items = new List <CObject>();
                foreach (var child in (JArray)token.SelectToken("Items"))
                {
                    var Item = new CObject()
                    {
                        ClassType       = child.SelectToken("ClassType").Value <string>(),
                        Description     = child.SelectToken("Description").Value <string>(),
                        IsClientPicture = child.SelectToken("IsClientPicture").Value <bool>(),
                        Picture         = child.SelectToken("Picture").Value <string>(),
                        Name            = child.SelectToken("Name").Value <string>(),
                        OverlayUID      = child.SelectToken("OverlayUID").Value <string>(),
                        ProjectUID      = child.SelectToken("ProjectUID").Value <string>(),
                        UID             = child.SelectToken("UID").Value <string>(),
                        SystemFullName  = child.SelectToken("SystemFullName").Value <string>()
                    };
                    if (Item.OverlayUID == null)
                    {
                        Item.OverlayUID = layer.UID;
                    }
                    if (Item.ProjectUID == null)
                    {
                        Item.ProjectUID = layer.ProjectUID;
                    }
                    Items.Add(Item);
                }
                o.Items = Items;

                result.Add(o);
            }
            return(result);
        }