示例#1
0
        /// <summary>
        /// Populates the branch in the tree view.
        /// </summary>
        /// <param name="sourceId">The NodeId of the Node to browse.</param>
        /// <param name="nodes">The node collect to populate.</param>
        private async void PopulateBranch(NodeId sourceId, TreeNodeCollection nodes)
        {
            nodes.Clear();
            nodes.Add(new TreeNode("Browsering...", 7, 7));
            // fetch references from the server.
            TreeNode[] listNode = await Task.Run(() =>
            {
                ReferenceDescriptionCollection references = GetReferenceDescriptionCollection(sourceId);
                List <TreeNode> list = new List <TreeNode>();
                if (references != null)
                {
                    // process results.
                    for (int ii = 0; ii < references.Count; ii++)
                    {
                        ReferenceDescription target = references[ii];
                        TreeNode child = new TreeNode(Utils.Format("{0}", target));

                        child.Tag              = target;
                        string key             = GetImageKeyFromDescription(target, sourceId);
                        child.ImageKey         = key;
                        child.SelectedImageKey = key;

                        // if (target.NodeClass == NodeClass.Object || target.NodeClass == NodeClass.Unspecified || expanded)
                        // {
                        //     child.Nodes.Add(new TreeNode());
                        // }

                        if (!checkBox1.Checked)
                        {
                            if (GetReferenceDescriptionCollection((NodeId)target.NodeId).Count > 0)
                            {
                                child.Nodes.Add(new TreeNode( ));
                            }
                        }
                        else
                        {
                            child.Nodes.Add(new TreeNode( ));
                        }


                        list.Add(child);
                    }
                }

                return(list.ToArray());
            });


            // update the attributes display.
            // DisplayAttributes(sourceId);
            nodes.Clear();
            nodes.AddRange(listNode.ToArray());
        }
示例#2
0
        private void OnLibreriaChange(object sender, EventArgs args)
        {
            TreeNodeCollection nodes = _mainContainer.LibreriaView.Nodes;

            nodes.Clear();
            TreeNode elementi = ELEMENTI_NODE;

            elementi.Nodes.Clear();
            FillImmaginiFisseNode(elementi);
            FillAnimazioniNode(elementi);
            TreeNode sequenze = SEQUENZE_NODE;

            sequenze.Nodes.Clear();
            FillSequenzeNode(sequenze);
            TreeNode progr = PROG_NODE;

            progr.Nodes.Clear();
            FillProgrammazioniGiornaliereNode(progr);
            if (elementi.Nodes.Count != 0)
            {
                nodes.Add(elementi);
            }
            if (sequenze.Nodes.Count != 0)
            {
                nodes.Add(sequenze);
            }
            if (progr.Nodes.Count != 0)
            {
                nodes.Add(progr);
            }
            _mainContainer.LibreriaView.ExpandAll();
        }
示例#3
0
        /// <summary>
        /// Обновляет подчиненные ветви нода
        /// </summary>
        /// <param name="nd">нод, чьи подчиненные ветви нужно обновить</param>
        public void RefreshSubNodes(DTreeNode nd)
        {
            TreeNodeCollection nds = (nd == null) ? Nodes : nd.Nodes;

            nds.Clear();
            LoadSubNodes(nd);
        }
示例#4
0
    protected void BindList(TreeNodeCollection ncTree, string pID)
    {
        ncTree.Clear();
        MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator();
        string query            = "select ID,Name,MenuLEVEL,PID from ht_svr_prt_menu ";

        if (pID == "")
        {
            query += " where pid is null ";
        }
        else
        {
            query += " where PID = '" + pID + "'";
        }
        DataSet data = opt.CreateDataSetOra(query);

        if (data != null && data.Tables[0].Rows.Count > 0)
        {
            DataRow[] Rows = data.Tables[0].Select();
            foreach (DataRow row in Rows)
            {
                TreeNode pnode = new TreeNode(row["Name"].ToString(), row["ID"].ToString() + "_" + row["MenuLEVEL"].ToString() + "_" + row["PID"].ToString());
                BindList(pnode.ChildNodes, row["ID"].ToString());
                ncTree.Add(pnode);
            }
        }
    }
示例#5
0
        private void PopulateTreeView()
        {
            TreeNodeCollection nodes = tvModelElements.Nodes;

            nodes.Clear();

            nodes.Add(CreateTreeNode("Entity Type", "EntityType"));
            nodes.Add(CreateTreeNode("Value Type", "ValueType"));
            nodes.Add(CreateTreeNode("Fact Type", "FactType"));
            nodes.Add(CreateTreeNode("Subtype Fact", "SubtypeFact"));
            nodes.Add(CreateTreeNode("Role", "Role"));
            nodes.Add(CreateTreeNode("ORM Model", "Model"));
            nodes.Add(CreateTreeNode("Group", "ElementGrouping"));

            TreeNode constraintsNode = CreateTreeNode("All Constraints", "AllConstraints");

            nodes.Add(constraintsNode);

            nodes = constraintsNode.Nodes;
            nodes.Add(CreateTreeNode("Mandatory Constraint", "MandatoryConstraint"));
            nodes.Add(CreateTreeNode("Uniqueness Constraint", "UniquenessConstraint"));
            nodes.Add(CreateTreeNode("Frequency Constraint", "FrequencyConstraint"));
            nodes.Add(CreateTreeNode("Ring Constraint", "RingConstraint"));
            nodes.Add(CreateTreeNode("Value Comparison Constraint", "ValueComparisonConstraint"));
            nodes.Add(CreateTreeNode("Equality Constraint", "EqualityConstraint"));
            nodes.Add(CreateTreeNode("Exclusion Constraint", "ExclusionConstraint"));
            nodes.Add(CreateTreeNode("Subset Constraint", "SubsetConstraint"));
            nodes.Add(CreateTreeNode("Cardinality Constraint", "CardinalityConstraint"));
            nodes.Add(CreateTreeNode("Value Constraint", "ValueConstraint"));
        }
示例#6
0
 private void build_remote_tree(string main, TreeNodeCollection tree)
 {
     tree.Clear();
     string[] online = eye.getDirContent(main);
     foreach (string file in online)
     {
         TreeNode node = new TreeNode(file);
         if (main == eyeSync.langs.eyeSync.loading)
         {
             if (eye.isDir(file))
             {
                 node.Nodes.Add(eyeSync.langs.eyeSync.loading);
                 node.Tag = file;
                 tree.Add(node);
             }
         }
         else
         {
             if (eye.isDir(main + "/" + file))
             {
                 node.Nodes.Add(eyeSync.langs.eyeSync.loading);
                 node.Tag = main + "/" + file;
                 tree.Add(node);
             }
         }
     }
 }
示例#7
0
        /// <summary>
        /// Рекурсивная сортировка веток TreeView.
        /// </summary>
        /// <param name="rootNodes">Коллекция веток подлежащая сортировке</param>
        private static void SortTreeNodes(
            TreeNodeCollection rootNodes,
            IComparer <TreeNode> comparer)
        {
            int count = rootNodes.Count;

            if (count == 0)
            {
                return;
            }

            // Копируем содержимое коллекции подветок в массив,
            // сортируем этот массв, очищаем коллекцию и копируем
            // подвекти обратно в коллекцию.
            TreeNode[] nodeArray = new TreeNode[count];
            rootNodes.CopyTo(nodeArray, 0);
            Array.Sort <TreeNode>(nodeArray, comparer);
            rootNodes.Clear();
            rootNodes.AddRange(nodeArray);

            // Сортируем все подветки
            foreach (TreeNode node in nodeArray)
            {
                SortTreeNodes(node.Nodes, comparer);
            }
        }
示例#8
0
        public virtual void LoadDirectory(TreeNodeCollection objNodes, CUserEntity user, int resourceId)
        {
            objNodes.Clear();

            //insert the root node
            List <CResourceEntity> children = user.ListDescendants(resourceId);

            foreach (CResourceEntity res in children)
            {
                if (res.Res_Type != (int)RESOURCETYPE.FOLDERRESOURCE)
                {
                    continue;
                }

                bool blnHasNodes            = false;
                List <CResourceEntity> list = user.ListResources(res.Res_Id);
                foreach (CResourceEntity r in list)
                {
                    if (r.Res_Type == (int)RESOURCETYPE.FOLDERRESOURCE)
                    {
                        blnHasNodes = true;
                        break;
                    }
                }

                TreeNode objNode = new TreeNode(res.Res_Name);
                objNode.Tag = res.Res_Id;

                objNode.IsExpanded = !blnHasNodes;
                objNode.HasNodes   = blnHasNodes;

                objNode.Loaded = !blnHasNodes;
                objNodes.Add(objNode);
            }
        }
        /// <summary>
        /// Populates the branch in the tree view.
        /// </summary>
        /// <param name="sourceId">The NodeId of the Node to browse.</param>
        /// <param name="nodes">The node collect to populate.</param>
        private async Task PopulateBranch(NodeId sourceId, TreeNodeCollection nodes)
        {
            try
            {
                nodes.Clear();

                // find all of the components of the node.
                BrowseDescription nodeToBrowse1 = new BrowseDescription();

                nodeToBrowse1.NodeId          = sourceId;
                nodeToBrowse1.BrowseDirection = BrowseDirection.Forward;
                nodeToBrowse1.ReferenceTypeId = ReferenceTypeIds.Aggregates;
                nodeToBrowse1.IncludeSubtypes = true;
                nodeToBrowse1.NodeClassMask   = (uint)(NodeClass.Object | NodeClass.Variable);
                nodeToBrowse1.ResultMask      = (uint)BrowseResultMask.All;

                // find all nodes organized by the node.
                BrowseDescription nodeToBrowse2 = new BrowseDescription();

                nodeToBrowse2.NodeId          = sourceId;
                nodeToBrowse2.BrowseDirection = BrowseDirection.Forward;
                nodeToBrowse2.ReferenceTypeId = ReferenceTypeIds.Organizes;
                nodeToBrowse2.IncludeSubtypes = true;
                nodeToBrowse2.NodeClassMask   = (uint)(NodeClass.Object | NodeClass.Variable);
                nodeToBrowse2.ResultMask      = (uint)BrowseResultMask.All;

                BrowseDescriptionCollection nodesToBrowse = new BrowseDescriptionCollection();
                nodesToBrowse.Add(nodeToBrowse1);
                nodesToBrowse.Add(nodeToBrowse2);

                Cursor.Current = Cursors.WaitCursor;
                // fetch references from the server.
                ReferenceDescriptionCollection references = await Task.Run(() => FormUtils.Browse(m_groupLog.Server.Connection.Session, nodesToBrowse, false));

                Cursor.Current = Cursors.Default;

                // process results.
                for (int ii = 0; ii < references.Count; ii++)
                {
                    ReferenceDescription target = references[ii];

                    // add node.
                    TreeNode child = new TreeNode(Utils.Format("{0}", target));
                    child.Tag = target;

                    child.Nodes.Add(new TreeNode());
                    nodes.Add(child);

                    if (target.NodeClass == NodeClass.Variable)
                    {
                        child.ImageKey         = "label_icon";
                        child.SelectedImageKey = "label_icon";
                    }
                }
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
示例#10
0
    private void sortD(TreeNodeCollection nodes)
    {
        sortDic = addDic(nodes);
        sortDic.Sort(
            delegate(KeyValuePair <int, int> firstPair,
                     KeyValuePair <int, int> nextPair)
        {
            return(firstPair.Key >= nextPair.Key ? 1 : -1);
        }
            );
        int i = 0;

        TreeNode[] tmpnodes = new TreeNode[nodes.Count];
        //nodes.Add("End");
        foreach (KeyValuePair <int, int> kvp in sortDic)
        {
            //TreeNode tmpnode = nodes[kvp.Value];
            //tmpnodes.Add(tmpnode);
            tmpnodes[i] = nodes[kvp.Value];
            //nodes.Remove(nodes[kvp.Value]);
            //nodes.Add(nodes[kvp.Value]);
            i++;
            //nodes.RemoveAt(kvp.Value);
        }
        nodes.Clear();
        i = nodes.Count;
        //for (int j = 0; j < i / 2; j++)
        //{
        //    nodes.RemoveAt(0);
        //}
        nodes.AddRange(tmpnodes);
        //tmpnodes.Clear();
    }
示例#11
0
        private void BuildFields(TreeNodeCollection nodes, EntitySchema entity)
        {
            nodes.Clear();

            foreach (var member in entity.Members.OrderBy(HumanText.GetMemberName))
            {
                var node = new TreeNode
                {
                    Text = HumanText.GetMemberName(member),
                    Tag  = member
                };

                switch (member.Type)
                {
                case EntityMemberType.Id:
                case EntityMemberType.Field:
                case EntityMemberType.Calculated:
                    break;

                case EntityMemberType.Foreign:
                    node.Nodes.Add("Dummy");
                    break;

                default:
                    continue;
                }

                nodes.Add(node);
            }
        }
 /// <summary>Refreshes the specified nodes.</summary>
 /// <param name="nodes">The nodes.</param>
 private void RefreshNodes(TreeNodeCollection nodes)
 {
     TreeNode[] dest = new TreeNode[nodes.Count];
     nodes.CopyTo(dest, 0);
     nodes.Clear();
     nodes.AddRange(dest);
 }
示例#13
0
 public void MakeRootOf(TreeNodeCollection nodes)
 {
     nodes.Clear();
     this.Node     = nodes.Add("<root>");
     this.Node.Tag = this;
     this.Winner   = WinnerPreserve;
 }
示例#14
0
        public virtual void InitDirectory(TreeNodeCollection objNodes, CUserEntity user, int resourceId)
        {
            objNodes.Clear();
            CResourceEntity rootRes = new CResourceEntity(user.ConnString).Load(resourceId);

            if (rootRes.Res_Type != (int)RESOURCETYPE.FOLDERRESOURCE)
            {
                return;
            }

            List <CResourceEntity> children = user.ListDescendants(resourceId);

            bool blnHasNodes = false;

            foreach (CResourceEntity r in children)
            {
                if (r.Res_Type == (int)RESOURCETYPE.FOLDERRESOURCE)
                {
                    blnHasNodes = true;
                    break;
                }
            }

            TreeNode objNode = new TreeNode(rootRes.Res_Name);

            objNode.Tag = resourceId;

            objNode.IsExpanded = !blnHasNodes;
            objNode.HasNodes   = blnHasNodes;

            objNode.Loaded = !blnHasNodes;
            objNodes.Add(objNode);
        }
示例#15
0
        public void RefreshView(TreeNode node)
        {
            this.BeginUpdate();
            try
            {
                TreeNodeCollection curNodes = (node != null ? node.Nodes : this.Nodes);

                curNodes.Clear();
                //mRowNodeTable.Clear();

                if (Table != null)
                {
                    string pidvalue = RootPIdValue;
                    if (node != null)
                    {
                        DataRow row = node.Tag as DataRow;
                        if (row != null)
                        {
                            pidvalue  = row[IdField].ToString();
                            node.Text = row[TextField].ToString();
                        }
                    }
                    BindTreeView(Table, curNodes, pidvalue, IdField, PIdField, TextField);
                }
            }
            finally
            {
                this.EndUpdate();
            }
        }
示例#16
0
        private void TreeView1_Load(object sender, EventArgs e)
        {
            listNews     = new List <New>(dbAccess.getNews());
            listArticles = new List <Article>(dbAccess.getArticles());

            TreeNodeCollection newsNodes     = TreeView1.FindNode("News.Root").ChildNodes;
            TreeNodeCollection articlesNodes = TreeView1.FindNode("Articles.Root").ChildNodes;

            newsNodes.Clear();
            foreach (New news in listNews)
            {
                TreeNode newNode = new TreeNode(news.Title);
                TreeNode nodeTxt = new TreeNode(news.Text);
                nodeTxt.SelectAction = TreeNodeSelectAction.None;
                newNode.ChildNodes.Add(nodeTxt);
                newNode.SelectAction = TreeNodeSelectAction.None;
                newsNodes.Add(newNode);
            }

            articlesNodes.Clear();
            foreach (Article article in listArticles)
            {
                TreeNode newNode = new TreeNode(article.Title);
                TreeNode nodeTxt = new TreeNode(article.Text);
                nodeTxt.SelectAction = TreeNodeSelectAction.None;
                newNode.ChildNodes.Add(nodeTxt);
                newNode.SelectAction = TreeNodeSelectAction.None;
                articlesNodes.Add(newNode);
            }
        }
示例#17
0
        public static void SortNodes(TreeNodeCollection nodes)
        {
            List <TreeNode> dirs  = new List <TreeNode>();
            List <TreeNode> files = new List <TreeNode>();

            foreach (TreeNode n in nodes)
            {
                if ((n.Tag as ProjectItem).IsDir)
                {
                    dirs.Add(n);
                }
                else
                {
                    files.Add(n);
                }
            }
            dirs.Sort(new Comparison <TreeNode>(delegate(TreeNode a, TreeNode b)
            {
                return(string.Compare((a.Tag as ProjectItem).Name, (b.Tag as ProjectItem).Name));
            }));
            files.Sort(new Comparison <TreeNode>(delegate(TreeNode a, TreeNode b)
            {
                return(string.Compare((a.Tag as ProjectItem).Name, (b.Tag as ProjectItem).Name));
            }));
            nodes.Clear();
            nodes.AddRange(dirs.ToArray());
            nodes.AddRange(files.ToArray());
        }
示例#18
0
        /// <summary>
        /// </summary>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="collectionToSort"/> is <see langword="null"/>.
        /// <paramref name="comparerToUse"/> is <see langword="null"/>.
        /// </exception>
        public void Sort <T>(TreeNodeCollection collectionToSort, IComparer <T> comparerToUse) where T : TreeNode
        {
            if (collectionToSort == null)
            {
                throw new ArgumentNullException("collectionToSort");
            }

            if (comparerToUse == null)
            {
                throw new ArgumentNullException("comparerToUse");
            }

            int nodesCount = collectionToSort.Count;

            if (nodesCount == 0)
            {
                return;
            }

            T[] nodes = new T[nodesCount];

            for (int i = 0; i < nodesCount; i++)
            {
                nodes[i] = (T)collectionToSort[i];
            }

            Array.Sort <T>(nodes, comparerToUse);
            collectionToSort.Clear();
            collectionToSort.AddRange(nodes);

            foreach (T treeNode in nodes)
            {
                this.Sort(treeNode.Nodes, comparerToUse);
            }
        }
示例#19
0
        private void PopulateTables(Database database)
        {
            TreeNodeCollection tableRootNodes = treeTables.Nodes;

            tableRootNodes.Clear();

            TreeNode nodeDatabase = AddTreeNode(tableRootNodes, database);
            var      schemas      = database.Schemas.OrderByDescending(item => item.Tables.Count).ThenBy(item => item.Name);

            if (schemas.Count() > 0)
            {
                foreach (var schema in schemas)
                {
                    TreeNode schemaNode = AddTreeNode(nodeDatabase.Nodes, schema);
                    if (schema.Tables.Count > 0)
                    {
                        foreach (var table in schema.Tables.OrderBy(item => item.Name))
                        {
                            AddTreeNode(schemaNode.Nodes, table);
                        }
                    }
                    else
                    {
                        HideCheckBoxForTreeNode(schemaNode);
                    }
                }
            }
            else
            {
                HideCheckBoxForTreeNode(nodeDatabase);
            }

            nodeDatabase.Expand();
        }
示例#20
0
        protected void treeViewPositionlist(TreeNodeCollection node, string MtID)
        {
            node.Clear();
            ///获取当前拥有的权限
            DataTable table;

            table = LinQBaseDao.Query("select * from Dictionary where Dictionary_OtherID=(select Dictionary_ID from Dictionary where Dictionary_Value='09') order by Dictionary_Sort asc").Tables[0];
            TreeNode nodeTemp;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                nodeTemp     = new TreeNode();
                nodeTemp.Tag = table.Rows[i]["Dictionary_ID"];
                if (table.Rows[i]["Dictionary_Name"] != null)
                {
                    nodeTemp.Text = table.Rows[i]["Dictionary_Name"].ToString();
                    nodeTemp.Name = table.Rows[i]["Dictionary_ID"].ToString();
                }
                if (Convert.ToBoolean(table.Rows[i]["Dictionary_State"]) == false)
                {
                    nodeTemp.BackColor = Color.Yellow;
                }
                if (nodeTemp != null)
                {
                    node.Add(nodeTemp);  //加入节点
                }
            }
        }
示例#21
0
        private void AddChildren(IntPtr hWnd, TreeNodeCollection nodes, int depth)
        {
            const int maxChildren = 100;

            depth--;

            if (depth <= 0)
            {
                return;
            }

            nodes.Clear();

            var handles = GetAllChildrenWindowHandles(hWnd, maxChildren);

            foreach (var handle in handles)
            {
                var node = CreateNode(handle);

                nodes.Add(node);

                AddChildren(handle, node.Nodes, depth);

                if (treeView.Nodes.Count == maxChildren)
                {
                    var brNode = nodes.Add("////////");
                    brNode.ForeColor = Color.Red;

                    break;
                }
            }
        }
示例#22
0
        /// <summary>
        /// Loads an XPathNavigatorTreeNode for each XPathNavigator in the specified XPathNodeIterator, into the
        /// specified TreeNodeCollection.
        /// </summary>
        /// <param name="iterator"></param>
        /// <param name="treeNodeCollection"></param>
        public virtual void LoadNodes(XPathNodeIterator iterator, TreeNodeCollection treeNodeCollection)
        {
            // handle null arguments
            if (iterator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            if (treeNodeCollection == null)
            {
                throw new ArgumentNullException("parentNodeCollection");
            }

            // use the wait cursor, in case this takes a while
            this.UseWaitCursor = true;

            try
            {
                treeNodeCollection.Clear();

                // create and add a node for each navigator
                foreach (XPathNavigator navigator in iterator)
                {
                    XPathNavigatorTreeNode node = new XPathNavigatorTreeNode(navigator.Clone());
                    treeNodeCollection.Add(node);
                }
            }
            finally
            {
                this.UseWaitCursor = false;
            }
        }
示例#23
0
        private void RefreshTreeViewNodes(TreeNodeCollection treeViewNodes, Func <TIdentifier, bool> parentIdCheck, Dictionary <TIdentifier, HashSet <TreeNode> > allLeaves = null)
        {
            treeViewNodes.Clear();
            foreach (var id in this.nodes.Keys)
            {
                var data     = this.GetTreeNodeWithParentId(id);
                var node     = data.NodeData;
                var parentId = data.ParentId;
                if (parentIdCheck(parentId))
                {
                    var parentNodeWithId = this.GetTreeNodeWithParentId(parentId);
                    if (parentNodeWithId == null)
                    {
                        // if node has an invalid parent (e.g. parent page is deleted), it can't be displayed in the tree
                        continue;
                    }

                    var parentNode = parentNodeWithId.NodeData;
                    parentNode.ChildNodes.Add(node);
                }
                else
                {
                    treeViewNodes.Add(node);
                }

                if (allLeaves != null && allLeaves.ContainsKey(id))
                {
                    foreach (var item in allLeaves[id])
                    {
                        node.ChildNodes.Add(item);
                    }
                }
            }
        }
示例#24
0
        private void RefreshTreeViewNodes(TreeNodeCollection treeViewNodes, Func <K, bool> parentIdCheck, Dictionary <K, HashSet <TreeNode> > allLeaves = null)
        {
            treeViewNodes.Clear();
            foreach (var id in _nodes.Keys)
            {
                var data     = GetTreeNodeWithParentId(id);
                var node     = data.NodeData;
                var parentId = data.ParentId;
                if (parentIdCheck(parentId))
                {
                    var parentNode = GetTreeNodeWithParentId(parentId).NodeData;
                    parentNode.ChildNodes.Add(node);
                }
                else
                {
                    treeViewNodes.Add(node);
                }

                if (allLeaves != null && allLeaves.ContainsKey(id))
                {
                    foreach (var item in allLeaves[id])
                    {
                        node.ChildNodes.Add(item);
                    }
                }
            }
        }
 /// <summary>
 /// 装载全部主表单
 /// </summary>
 /// <param name="startNodes"></param>
 public static void LoadAllMainUserControls(TreeNodeCollection startNodes)
 {
     try
     {
         var table = RDIFrameworkService.Instance.WorkFlowUserControlService.GetAllMainUserControls(SystemInfo.UserInfo);
         startNodes.Clear();
         foreach (DataRow row in table.Rows)
         {
             var tmpNode = new MainUserControlNode
             {
                 NodeId             = row[MainUserControlTable.FieldId].ToString(),
                 ImageIndex         = 2,
                 ToolTipText        = "主表单",
                 SelectedImageIndex = 3,
                 Text        = row[MainUserControlTable.FieldFullName].ToString(),
                 Description = row[MainUserControlTable.FieldDescription].ToString(),
                 NodeType    = WorkConst.UserControl_Main
             };
             startNodes.Add(tmpNode);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#26
0
        public override void InitDirectory(TreeNodeCollection objNodes, CUserEntity user, int resourceId)
        {
            objNodes.Clear();
            // Add tree root
            TreeNode rootNode = new TreeNode("¹²ÏíĿ¼");

            objNodes.Add(rootNode);

            List <CResourceEntity> children = user.ListShareResources();
            bool blnHasNodes = false;

            foreach (CResourceEntity res in children)
            {
                if (res.Res_Type == (int)RESOURCETYPE.FOLDERRESOURCE)
                {
                    blnHasNodes = true;
                    break;
                }
            }

            rootNode.Tag = 0;

            rootNode.IsExpanded = !blnHasNodes;
            rootNode.HasNodes   = blnHasNodes;
            rootNode.Loaded     = false;
        }
 /// <summary>
 /// 递归装载全部流程类型
 /// </summary>
 /// <param name="key"></param>
 /// <param name="startNodes"></param>
 public static void LoadWorkFlowClass(string key, TreeNodeCollection startNodes)
 {
     try
     {
         var table = RDIFrameworkService.Instance.WorkFlowTemplateService.GetChildWorkFlowClass(SystemInfo.UserInfo, key);
         startNodes.Clear();
         foreach (DataRow row in table.Rows)
         {
             var tmpNode = new WorkFlowClassTreeNode
             {
                 NodeId             = row[WorkFlowClassTable.FieldWFClassId].ToString(),
                 ImageIndex         = 0,
                 ToolTipText        = "分类",
                 clLevel            = Convert.ToInt16(row[WorkFlowClassTable.FieldClLevel]),
                 SelectedImageIndex = 1,
                 Text = row[WorkFlowClassTable.FieldCaption].ToString(),
                 WorkflowFatherClassId = row[WorkFlowClassTable.FieldFatherId].ToString(),
                 Description           = row[WorkFlowClassTable.FieldDescription].ToString(),
                 MgrUrl   = row[WorkFlowClassTable.FieldClMgrUrl].ToString(),
                 NodeType = WorkConst.WORKFLOW_CLASS
             };
             startNodes.Add(tmpNode);
             LoadWorkFlowClass(tmpNode.NodeId, tmpNode.Nodes);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#28
0
        /// <summary>
        /// 删除相同的节点
        /// </summary>
        private void DeleteSame(TreeNodeCollection tvc)
        {
            int             count = 0;
            List <TreeNode> list  = new List <TreeNode>();

            foreach (TreeNode node in tvc)
            {
                DeleteSame(node.Nodes);
                if (node.ForeColor == Color.Red || node.Nodes.Count > 0)
                {
                    list.Add(node);
                }
                count = count + node.Nodes.Count;
            }

            if (list.Count == 0 && count == 0)
            {
                tvc.Clear();
            }
            else
            {
                int len = tvc.Count;
                for (int i = len - 1; i >= 0; i--)
                {
                    if (!list.Contains(tvc[i]))
                    {
                        tvc.Remove(tvc[i]);
                    }
                }
            }
        }
示例#29
0
        public virtual void LoadDirectory(TreeNodeCollection objNodes, string strPath)
        {
            objNodes.Clear();

            //insert the root node
            DirectoryInfo objDir = new DirectoryInfo(strPath);

            foreach (DirectoryInfo objSubDir in objDir.GetDirectories( ))
            {
                bool blnHasNodes = objSubDir.GetDirectories( ).Length > 0;


                TreeNode objNode = new TreeNode(objSubDir.Name);
                objNode.Tag = objSubDir.FullName;
                //objNode.DragTargets = treeView1.DragTargets;

                objNode.IsExpanded = !blnHasNodes;
                objNode.HasNodes   = blnHasNodes;

                objNode.Loaded = !blnHasNodes;

                //objNode.Image = new ImageResourceHandle ( "Folder.gif" );
                //objNode.ExpandedImage = new ImageResourceHandle ( "Folder.gif" );

                objNodes.Add(objNode);
            }
        }
示例#30
0
        protected void UpdateTreeView(bool showPending)
        {
            TreeNodeCollection nodes = tvDeviceTree.Nodes;

            nodes.Clear();
            TreeNode devicesNode = nodes.Add("DevicesKey", "Devices");
            IDictionary <string, RootDescriptor> knownDevices = _networkTracker.KnownRootDevices;

            try
            {
                if (knownDevices == null)
                {
                    if (showPending)
                    {
                        devicesNode.Nodes.Add(null, " - pending -");
                    }
                    return;
                }
                foreach (RootDescriptor rootDescriptor in knownDevices.Values)
                {
                    if (rootDescriptor.State != RootDescriptorState.Ready)
                    {
                        continue;
                    }
                    string           deviceUUID       = rootDescriptor.SSDPRootEntry.RootDeviceUUID;
                    DeviceDescriptor deviceDescriptor = DeviceDescriptor.CreateRootDeviceDescriptor(rootDescriptor);
                    TreeNode         deviceNode       = devicesNode.Nodes.Add(deviceUUID, BuildDeviceName(deviceDescriptor));
                    deviceNode.Tag = new UPnPDeviceDescriptor(deviceDescriptor);
                }
            }
            finally
            {
                devicesNode.Expand();
            }
        }
    private void BindRoleTree(TreeNodeCollection TNC)
    {
        TNC.Clear();
        string[] roles = Roles.GetAllRoles();

        foreach (string role in roles)
        {
            TreeNode tn = new TreeNode();
            tn.Text = role;
            tn.Value = role;
            if (Request.QueryString["RoleName"] != null && role == Request.QueryString["RoleName"])
            {
                tn.Selected = true;
            }
            TNC.Add(tn);
        }

        if (tr_Role.SelectedValue == "" && tr_Role.Nodes.Count > 0)
        {
            tr_Role.Nodes[0].Selected = true;
        }
        BindModuleTree();
    }
    private void BindTree(TreeNodeCollection TNC)
    {
        TNC.Clear();
        string[] roles = Roles.GetAllRoles();

        foreach (string role in roles)
        {
            TreeNode tn = new TreeNode();
            tn.Text = role;
            tn.Value = role;
            TNC.Add(tn);
        }

        if (tr_Role.Nodes.Count > 0)
            tr_Role.Nodes[0].Selected = true;

        BindGrid();
    }