Exemple #1
0
 public bool InsertNode(int insertIndex, WCSPathNodeModel node)
 {
     if (nodePath.Count() < insertIndex)
     {
         return(false);
     }
     nodePath.Insert(insertIndex, node);
     return(true);
 }
Exemple #2
0
        public bool ContainNode(string nodeID)
        {
            WCSPathNodeModel node = GetNodeByID(nodeID);

            if (node == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #3
0
        public bool BuildPath(XElement pathRoot, ref string reStr)
        {
            try
            {
                IEnumerable <XElement> nodes = pathRoot.Elements("Node");
                pathKey  = pathRoot.Attribute("pathKey").Value.ToString();
                pathDesc = pathRoot.Attribute("desc").Value.ToString();
                pathID   = pathRoot.Attribute("ID").Value.ToString();
                foreach (XElement xeNode in nodes)
                {
                    WCSPathNodeModel wcsNode = new WCSPathNodeModel();
                    if (!wcsNode.BuildPath(xeNode, ref reStr))
                    {
                        return(false);
                    }

                    AddNode(wcsNode);
                }
                for (int i = 0; i < nodePath.Count(); i++)
                {
                    WCSPathNodeModel wcsNode = nodePath[i];
                    if (i == 0)
                    {
                        wcsNode.LastNodeID = "";
                    }
                    else
                    {
                        wcsNode.LastNodeID = nodePath[i - 1].NodeID;
                    }
                    if (i == nodePath.Count() - 1)
                    {
                        wcsNode.NextNodeID = "";
                    }
                    else
                    {
                        wcsNode.NextNodeID = nodePath[i + 1].NodeID;
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                reStr = ex.ToString();
                return(false);
            }
        }
Exemple #4
0
 public bool DelNode(WCSPathNodeModel node)
 {
     return(nodePath.Remove(node));
 }
Exemple #5
0
 public void AddNode(WCSPathNodeModel node)
 {
     nodePath.Add(node);
 }