public bool InsertNode(int insertIndex, WCSPathNodeModel node) { if (nodePath.Count() < insertIndex) { return(false); } nodePath.Insert(insertIndex, node); return(true); }
public bool ContainNode(string nodeID) { WCSPathNodeModel node = GetNodeByID(nodeID); if (node == null) { return(false); } else { return(true); } }
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); } }
public bool DelNode(WCSPathNodeModel node) { return(nodePath.Remove(node)); }
public void AddNode(WCSPathNodeModel node) { nodePath.Add(node); }