private TreeNodes SearchNodesInprivate(TreeNodes targetNodes, string namePath) { var targetPath = namePath.Split('.'); bool validPath = false; TreeNodes existsNodes = null; var validNode = from x in targetNodes.Nodes where x.Name.ToLower() == targetPath[0].ToLower() select x; if ((validNode != null) && (validNode.Count() > 0)) { existsNodes = validNode.FirstOrDefault(); validPath = true; } if (!validPath) { return(targetNodes); } var nextPath = namePath.Substring(targetPath[0].Length, namePath.Length - targetPath[0].Length); if (nextPath.StartsWith(".")) { nextPath = nextPath.Substring(1, nextPath.Length - 1); } if (nextPath.Trim() == "") { return(existsNodes); } return(this.SearchNodesInprivate(existsNodes, nextPath)); }
public void AddNode(TreeNodes target) { lock (_syncLock) { _nodes.Add(target); } }
private TreeNodes SearchNodes(TreeNodes targetNodes, string namePath) { var targetPath = namePath.Split('.'); bool validPath = false; TreeNodes existsNodes = null; foreach (var childNode in targetNodes.Nodes) { if (childNode.Name.ToLower() != targetPath[0].ToLower()) { continue; } validPath = true; existsNodes = childNode; break; } if (!validPath) { return(targetNodes); } var nextPath = namePath.Substring(targetPath[0].Length, namePath.Length - targetPath[0].Length); if (nextPath.StartsWith(".")) { nextPath = nextPath.Substring(1, nextPath.Length - 1); } if (string.IsNullOrEmpty(nextPath.Trim())) { return(existsNodes); } return(this.SearchNodes(existsNodes, nextPath)); }
private void CommitIntellisenseItem(TreeNodes selectedNodes) { var inputText = _startText; inputText += selectedNodes.Name; editor.Text = inputText; editor.SelectionStart = editor.Text.Length; editor.UpdateLayout(); this.UnInitilaizePopup(); }
private TreeNodes CreateUpdatedIntellisense(IEnumerable <ModelItem> vars) { TreeNodes result = IntellisenseData; lock (_intellisenseLock) { foreach (var vs in vars) { var vsProp = vs.Properties["Name"]; if (vsProp == null) { continue; } var varName = vsProp.ComputedValue; var res = from x in result.Nodes where x.Name == varName.ToString() select x; if (res.FirstOrDefault() == null) { Type sysType = null; var sysTypeProp = vs.Properties["Type"]; if (sysTypeProp != null) { sysType = (Type)sysTypeProp.ComputedValue; } TreeNodes newVar = new TreeNodes { Name = varName.ToString(), ItemType = TreeNodes.NodeTypes.Primitive, SystemType = sysType, Description = "" }; result.Nodes.Add(newVar); } } } return(result); }