Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 public void AddNode(TreeNodes target)
 {
     lock (_syncLock)
     {
         _nodes.Add(target);
     }
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        private void CommitIntellisenseItem(TreeNodes selectedNodes)
        {
            var inputText = _startText;

            inputText += selectedNodes.Name;

            editor.Text           = inputText;
            editor.SelectionStart = editor.Text.Length;
            editor.UpdateLayout();
            this.UnInitilaizePopup();
        }
Ejemplo n.º 5
0
        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);
        }