Inheritance: IList, ICollection, IEnumerable
Esempio n. 1
1
        public void initTrvTree(TreeNodeCollection treeNodes, string strParentIndex, DataView dvList)
        {
            try
            {
                TreeNode tempNode;
                DataView dvList1;
                string currentNum;
                dvList1 = dvList;
                // select the datarow that it's parentcode is strParentIndex
                DataRow[] dataRows = dvList.Table.Select("parentCode ='" + strParentIndex + "'");
                foreach (DataRow dr in dataRows)
                {
                    tempNode = new TreeNode();
                    tempNode.Text = dr["bookTypeCode"].ToString() + "-"
                        + dr["bookTypeName"].ToString();
                    // tag property is save data about this treenode
                    tempNode.Tag = new treeNodeData(dr["bookTypeCode"].ToString(),
                        dr["bookTypeName"].ToString(), dr["bookTypeExplain"].ToString(),
                        dr["currentCode"].ToString(), dr["parentCode"].ToString());

                    currentNum = dr["currentCode"].ToString();
                    treeNodes.Add(tempNode);
                    // call rucursive
                    TreeNodeCollection temp_nodes = treeNodes[treeNodes.Count - 1].Nodes;
                    initTrvTree(temp_nodes, currentNum, dvList1);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("初始化TreeView失败");
            }
        }
 /// <summary>
 /// 获取注册表项的子节点,并将其添加到树形控件节点中
 /// </summary>
 /// <param name="nodes"></param>
 /// <param name="rootKey"></param>
 public void GetSubKey(TreeNodeCollection nodes, RegistryKey rootKey)
 {
     if (nodes.Count != 0) return;
     //获取项的子项名称列表
     string[] keyNames = rootKey.GetSubKeyNames();
     //遍历子项名称
     foreach (string keyName in keyNames)
     {
     try
     {
     //根据子项名称功能注册表项
     RegistryKey key = rootKey.OpenSubKey(keyName);
     //如果表项不存在,则继续遍历下一表项
     if (key == null) continue;
     //根据子项名称创建对应树形控件节点
     TreeNode TNRoot = new TreeNode(keyName);
     //将注册表项与树形控件节点绑定在一起
     TNRoot.Tag = key;
     //向树形控件中添加节点
     nodes.Add(TNRoot);
     }
     catch
     {
     //如果由于权限问题无法访问子项,则继续搜索下一子项
     continue;
     }
     }
 }
Esempio n. 3
0
        bool SelectJoint(System.Windows.Forms.TreeNodeCollection nodes, string name)
        {
            foreach (TreeNode tn in nodes)
            {
                if (tn.Tag != null)
                {
                    ComboBox cb = (ComboBox)(((TabControl)this.Parent).Tag);

                    object o = (cb.Items[(int)tn.Tag] as CountedListItem).Object;
                    if (o is AbstractCresChildren)
                    {
                        if (((AbstractCresChildren)o).GetName().Trim().ToLower().StartsWith(name))
                        {
                            cres_tv.SelectedNode = tn;
                            tn.EnsureVisible();
                            return(true);
                        }
                    }
                }
                if (SelectJoint(tn.Nodes, name))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 4
0
        /// <summary>
        /// Sets the selected node to the one specifide by the given path.
        /// </summary>
        /// <param name="p_strPath">The path to the node to be selected.</param>
        public void SetSelectedNode(string p_strPath)
        {
            if (String.IsNullOrEmpty(p_strPath))
            {
                return;
            }
            string[] strPaths = p_strPath.Split(new char[] { Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
            if (strPaths[0].EndsWith(Path.VolumeSeparatorChar.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                strPaths[0] = strPaths[0] + Path.DirectorySeparatorChar;
            }
            TreeNode tndSelectedNode = null;

            System.Windows.Forms.TreeNodeCollection tncCurrentLevel = Nodes;
            for (Int32 i = 0; i < strPaths.Length; i++)
            {
                foreach (TreeNode tndCurrent in tncCurrentLevel)
                {
                    if (tndCurrent.Text.Equals(strPaths[i], StringComparison.OrdinalIgnoreCase))
                    {
                        tndSelectedNode = tndCurrent;
                        break;
                    }
                }
                if ((tndSelectedNode == null) || (tncCurrentLevel == tndSelectedNode.Nodes))
                {
                    break;
                }
                LoadChildren((FileSystemTreeNode)tndSelectedNode);
                tncCurrentLevel = tndSelectedNode.Nodes;
            }
            SelectedNode = tndSelectedNode;
        }
Esempio n. 5
0
        /// <summary>
        /// Finds the specified node, or the specified node's nearest ancestor if the specified
        /// node does not exist.
        /// </summary>
        /// <param name="p_tndRoot">The node under which to search for the specified node.</param>
        /// <param name="p_strPath">The path to the node to be found.</param>
        /// <param name="p_queMissingPath">An out parameter that returns the path parts that were not found.</param>
        /// <returns>The specified node, it if exists. If it does not exist, then the specified node's
        /// neasrest ancestor. If no ancestor exists, then <c>null</c> is returned.</returns>
        protected FileSystemTreeNode FindNearestAncestor(FileSystemTreeNode p_tndRoot, string p_strPath, out Queue <string> p_queMissingPath)
        {
            string[] strPaths = p_strPath.Split(new char[] { Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
            if (strPaths[0].EndsWith(Path.VolumeSeparatorChar.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                strPaths[0] = strPaths[0] + Path.DirectorySeparatorChar;
            }
            Queue <string>     quePath         = new Queue <string>(strPaths);
            FileSystemTreeNode tndSelectedNode = null;

            System.Windows.Forms.TreeNodeCollection tncCurrentLevel = (p_tndRoot == null) ? Nodes : p_tndRoot.Nodes;
            string strCurrentPath = null;

            while (quePath.Count > 0)
            {
                strCurrentPath = quePath.Peek();
                foreach (FileSystemTreeNode tndCurrent in tncCurrentLevel)
                {
                    if (tndCurrent.Text.Equals(strCurrentPath, StringComparison.OrdinalIgnoreCase))
                    {
                        tndSelectedNode = tndCurrent;
                        break;
                    }
                }
                if ((tndSelectedNode == null) || (tncCurrentLevel == tndSelectedNode.Nodes))
                {
                    break;
                }
                tncCurrentLevel = tndSelectedNode.Nodes;
                quePath.Dequeue();
            }
            p_queMissingPath = quePath;
            return(tndSelectedNode);
        }
        //Chequear privilegios actuales
        private void ChequearMenu(string Menu, string Campo, System.Windows.Forms.TreeNodeCollection mNode)
        {
            int i = 0;

            for (i = 0; i < mNode.Count; i++)
            {
                if (Campo.Equals("mnu_nombre"))
                {
                    if (mNode[i].Text.ToString().ToUpper().Trim().Equals(Menu.ToUpper().Trim()))
                    {
                        mNode[i].Checked = true;
                        break;
                    }
                }
                else
                {
                    if (mNode[i].Tag.ToString().ToUpper().Equals(Menu.ToUpper().Trim()))
                    {
                        mNode[i].Checked = true;
                        break;
                    }
                }
                ChequearMenu(Menu, Campo, mNode[i].Nodes);
            }
        }
        private void expandNamespace_function(TreeNodeCollection outNodes, TreeNode outInstanceMethods, string strSection, string strNamespace, XmlReader reader)
        {
            bool bContinue = reader.ReadToDescendant("function");
            while (bContinue)
            {

               // if (reader.GetAttribute("args") != null) MessageBox.Show("instance?");

                NodeDocLnzFunction node = new NodeDocLnzFunction(strSection, strNamespace, reader.GetAttribute("name"));

                bool bInstance = reader.GetAttribute("instance") == "true";
                node.bIsInstanceMethod = bInstance;
                string strArgs = reader.GetAttribute("args"); if (strArgs != null && strArgs != "") node.strArguments = strArgs;
                string strReturns = reader.GetAttribute("returns"); if (strReturns != null && strReturns != "") node.strReturns = strReturns;
                node.strDocumentationAndExample = getFunctionDocAndExample(reader.ReadSubtree()); //assumes doc before example

                if (bInstance)
                {
                    //MessageBox.Show("instance found");
                    outInstanceMethods.Nodes.Add(node);
                }
                else
                    outNodes.Add(node);

                bContinue = ReadToNextSibling(reader, "function");
            }
            reader.Close();
        }
Esempio n. 8
0
 private void InitTreeView(IEnumerable<string> roots, TreeNodeCollection childNodes)
 {
     foreach (var root in roots)
     {
         childNodes.Add(root).Nodes.Add("tmpNode");
     }
 }
Esempio n. 9
0
        private void AddNode(TreeNodeCollection parentTreeNodes, XElement element)
        {
            StringBuilder sb = new StringBuilder();

            string attrstring = string.Join(" ", element.Attributes().Select(a => a.Name + "=\"" + a.Value + "\""));
            if (attrstring != string.Empty)
            {
                sb.Append(" " + attrstring);
            }

            string innertext = element.Value;
            if (innertext != string.Empty)
            {
                sb.Append(" Value=\"" + innertext + "\"");
            }

            TreeNode treenode = new TreeNode();
            treenode.Text = element.Name.LocalName + sb.ToString();
            parentTreeNodes.Add(treenode);

            foreach (XElement child in element.Descendants())
            {
                AddNode(treenode.Nodes, child);
            }

            treenode.Expand();
        }
Esempio n. 10
0
 private void Find(System.Windows.Forms.TreeNodeCollection Nodes, string find)
 {
     foreach (System.Windows.Forms.TreeNode treeNode in Nodes)
     {
         if (treeNode.Text.Contains(find) && treeNode.Nodes.Count != 0)
         {
             this.TreeN.Add(treeNode);
             break;
         }
         if (this.BrowseCTRL.IsBrowseElementNode(treeNode))
         {
             if (treeNode.Nodes.Count >= 1 && treeNode.Nodes[0].Text == "")
             {
                 if (!treeNode.Text.Contains("alrosa_w") && !treeNode.Text.Contains("Internal") && !treeNode.Text.Contains("OPC") && !treeNode.Text.Contains("List of"))
                 {
                     this.BrowseCTRL.Browse(treeNode);
                 }
             }
         }
         if (this.TreeN.Count > 0)
         {
             break;
         }
         if (treeNode.Nodes.Count > 0)
         {
             this.Find(treeNode.Nodes, find);
         }
     }
 }
 private void PopulateSchemaRecursive(System.Windows.Forms.TreeNodeCollection nodes, IDataSourceViewSchema viewSchema, int depth, IDictionary duplicates)
 {
     if (viewSchema != null)
     {
         SchemaTreeNode node = new SchemaTreeNode(viewSchema);
         nodes.Add(node);
         SchemaTreeNode node2 = (SchemaTreeNode)duplicates[viewSchema.Name];
         if (node2 != null)
         {
             node2.Duplicate = true;
             node.Duplicate  = true;
         }
         foreach (TreeNodeBinding binding in this._bindingsListView.Items)
         {
             if (string.Compare(binding.DataMember, viewSchema.Name, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 IDataSourceViewSchemaAccessor accessor = binding;
                 if ((depth == binding.Depth) || (accessor.DataSourceViewSchema == null))
                 {
                     accessor.DataSourceViewSchema = viewSchema;
                 }
             }
         }
         IDataSourceViewSchema[] children = viewSchema.GetChildren();
         if (children != null)
         {
             for (int i = 0; i < children.Length; i++)
             {
                 this.PopulateSchemaRecursive(node.Nodes, children[i], depth + 1, duplicates);
             }
         }
     }
 }
Esempio n. 12
0
 public static void ExpandNodes(TreeNodeCollection nodes )
 {
     foreach (TreeNode tn in nodes)
     {
         tn.Expand();
     }
 }
Esempio n. 13
0
        private void PopulateNodes(DataTable dt, TreeNodeCollection nodes)
        {
            if ((dt == null) || (dt.Rows.Count == 0))
                return;

            if (nodes == null)
            {
                TreeNode tn = new TreeNode();
                tn.Text = "אין קטגוריות";
                tn.ToolTipText = "-1";
                nodes.Add(tn);
            }

            foreach (DataRow dr in dt.Rows)
            {
                string name = dr["CatHebrewName"].ToString().Trim();
                string id = dr["CatId"].ToString().Trim();
                TreeNode tn = new TreeNode();
                tn.Text = name;
                tn.ToolTipText = id;
                try
                {
                    nodes.Add(tn);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }

                DataTable childDT = GetTableFromQuery(String.Format("select * FROM Table_LookupCategories WHERE ParentCatId='{0}'", id));
                PopulateNodes(childDT, tn.Nodes);
            }
        }
Esempio n. 14
0
        public static void calculateAllTracesFromFunction(String sSignature, TreeNodeCollection tncTraces,
                                                          List<String> lFunctionsCalled,
                                                          String sFilter_Signature, String sFilter_Parameter,
                                                          bool bUseIsCalledBy, ICirDataAnalysis fcdAnalysis)
        {
            TreeNode tnNewTreeNode = O2Forms.newTreeNode(sSignature, sSignature, 0, sSignature);
            tncTraces.Add(tnNewTreeNode);

            if (fcdAnalysis.dCirFunction_bySignature.ContainsKey(sSignature))
            {
                ICirFunction cfCirFunction = fcdAnalysis.dCirFunction_bySignature[sSignature];
                List<ICirFunction> lsFunctions = new List<ICirFunction>();
                if (bUseIsCalledBy)
                    foreach(var cirFunctionCall in cfCirFunction.FunctionIsCalledBy)
                        lsFunctions.Add(cirFunctionCall.cirFunction);
                else
                    lsFunctions.AddRange(cfCirFunction.FunctionsCalledUniqueList);                                               

                foreach (ICirFunction cirFunction in lsFunctions)
                    if (false == lFunctionsCalled.Contains(cirFunction.FunctionSignature))
                    {
                        lFunctionsCalled.Add(cirFunction.FunctionSignature);
                        calculateAllTracesFromFunction(cirFunction.FunctionSignature, tnNewTreeNode.Nodes, lFunctionsCalled,
                                                       sFilter_Signature, sFilter_Parameter, bUseIsCalledBy,
                                                       fcdAnalysis);
                    }
                    else
                        tnNewTreeNode.Nodes.Add("(Circular ref) : " + cirFunction.FunctionSignature);
            }
        }
Esempio n. 15
0
        void PerformPopulateNodes(System.Windows.Forms.TreeNodeCollection nodes, ITreeStore item)
        {
            nodes.Clear();
            var count = item.Count;

            for (int i = 0; i < count; i++)
            {
                var child = item[i];
                var node  = new swf.TreeNode
                {
                    Text = child.Text,
                    Name = child.Key,
                    Tag  = child,
                };
                SetImage(child, node);

                if (child.Expandable)
                {
                    if (child.Expanded)
                    {
                        PerformPopulateNodes(node.Nodes, child);
                        node.Expand();
                    }
                    else
                    {
                        node.Nodes.Add(EmptyName, string.Empty);
                    }
                }

                nodes.Add(node);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Get node by path.
        /// </summary>
        /// <param name="nodes">Collection of nodes.</param>
        /// <param name="path">TreeView path for node.</param>
        /// <returns>Returns null if the node won't be find, otherwise <see cref="TreeNode"/>.</returns>
        public static TreeNode GetNodeByPath(TreeNodeCollection nodes, string path)
        {
            foreach (TreeNode currentNode in nodes)
            {
                if (Path.GetExtension(currentNode.FullPath) != string.Empty)
                {
                    continue;
                }

                if (currentNode.FullPath == path)
                {
                    return currentNode;
                }

                if (currentNode.Nodes.Count > 0)
                {
                    TreeNode treeNode = GetNodeByPath(currentNode.Nodes, path);

                    // Check if we found a node.
                    if (treeNode != null)
                    {
                        return treeNode;
                    }
                }
            }

            return null;
        }
Esempio n. 17
0
        internal void ShowData(TreeNodeCollection nodes)
        {
            var lst = getSelection(nodes);
            chart.Series.Clear();

            var logarithmic = btnLogarithmicScale.Checked;

            var area = chart.ChartAreas[0];
            area.AxisY.IsLogarithmic = logarithmic;

            var chartType = cboStyle.Text.AsEnum<SeriesChartType>(SeriesChartType.Spline);

            foreach(var sel in lst)
            {
                var series = chart.Series.Add( sel.m_Type.Name + "::" + sel.m_Source );
                series.ChartType = chartType;

                foreach(var d in sel.m_Data)
                {
                    var v = d.ValueAsObject;

                    if (logarithmic)
                    {
                        if (v is long) v = 1 +(long)v;
                        if (v is double) v = 1 +(double)v;
                    }
                    series.Points.AddXY(d.UTCTime, v );
                }
            }
        }
Esempio n. 18
0
 private void LoadTagBlockValuesAsNodes(TreeNodeCollection treeNodeCollection, TagBlock block)
 {
     //Add this TagBlock (chunk) to the Nodes
     treeNodeCollection.Add(block.ToString());
     int index = treeNodeCollection.Count - 1;
     treeNodeCollection[index].ContextMenuStrip = chunkMenu;
     //Add the TagBlock (chunk) object to the Tag to let use edit it directly from the node
     treeNodeCollection[index].Tag = block;
     //Values might be null, dealio
     if (block.Values == null) return;
     foreach (Value val in block.Values)
     {
         //the Values can be a bunch of things, we only want the ones that are TagBlockArrays (reflexives)
         if (val is TagBlockArray)
         {
             treeNodeCollection[index].Nodes.Add(val.ToString());
             treeNodeCollection[index].Nodes[treeNodeCollection[index].Nodes.Count - 1].ContextMenuStrip = reflexiveMenu;
             //Add the TagBlockArray object (reflexive) to the Tag to let us edit it directly from the node
             treeNodeCollection[index].Nodes[treeNodeCollection[index].Nodes.Count - 1].Tag = val;
             //TagBlocks also might be null, dealio
             if ((val as TagBlockArray).TagBlocks == null) continue;
             foreach (TagBlock tagBlock in (val as TagBlockArray).TagBlocks)
             {
                 //Recurse
                 LoadTagBlockValuesAsNodes(treeNodeCollection[index].Nodes[treeNodeCollection[index].Nodes.Count - 1].Nodes, tagBlock);
             }
         }
     }
 }
 internal static NodeBase FindNodeByObject(TreeNodeCollection treeNodeCollection, object obj)
 {
     foreach (NodeBase node in treeNodeCollection)
         if (node.Object == obj)
             return node;
     return null;
 }
Esempio n. 20
0
        private void FillTreeView(TreeNodeCollection nodeCollection, TabControl tab)
        {
            if (nodeCollection != null && tab != null)
            {
                foreach (TabPage tabPage in tab.TabPages)
                {
                    TreeNode treeNode = new TreeNode(tabPage.Text);
                    if (!string.IsNullOrEmpty(tabPage.ImageKey))
                    {
                        treeNode.ImageKey = treeNode.SelectedImageKey = tabPage.ImageKey;
                    }
                    treeNode.Tag = tabPage;
                    nodeCollection.Add(treeNode);

                    foreach (Control control in tabPage.Controls)
                    {
                        if (control is TabControl)
                        {
                            FillTreeView(treeNode.Nodes, control as TabControl);
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 21
0
 private void PopulateTree(Node currentNode, TreeNodeCollection parentsNodes)
 {
     TreeNode newNode = new TreeNode("[ " + currentNode.Type + "] " + currentNode.Value);
     parentsNodes.Add(newNode);
     foreach (Node child in currentNode.Children)
         PopulateTree(child, newNode.Nodes);
 }
        private void expandNamespace_function(TreeNodeCollection outNodes, string strSection, string strNamespace, XmlReader reader)
        {
            bool bContinue = reader.ReadToDescendant("function");
            while (bContinue)
            {
                NodeDocPythonFunction node = newnode(strSection, strNamespace, reader.GetAttribute("name"));
                outNodes.Add(node);

                bool bInstance = reader.GetAttribute("instance") == "true";
                node.bIsInstanceMethod = bInstance;
                string strSyntax = reader.GetAttribute("fullsyntax"); if (strSyntax != null && strSyntax != "") node.strFullSyntax = strSyntax;
                node.strDocumentation = getFunctionDocAndExample(reader.ReadSubtree()); //assumes doc before example

                if (this.emphasizeStaticness())
                {
                    if (!bInstance)
                    {
                        //change visible node text to emphasize static-ness
                        node.Text = node.strNamespacename + "." + node.strFunctionname;
                    }
                }
                bContinue = ReadToNextSibling(reader, "function");
            }

            reader.Close();
        }
Esempio n. 23
0
		public static void reorderItems(TreeNodeCollection nodes, IProject project)
		{
			//ProjectService.MarkProjectDirty(project)
			project.Save();
			XmlDocument doc = new XmlDocument();
			doc.Load(project.FileName);
			XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
			nsmgr.AddNamespace("proj", "http://schemas.microsoft.com/developer/msbuild/2003");
			var d = new Dictionary<FileNode, XmlNode>();
			foreach (FileNode node in getFileNodes(nodes)) {
				var docNode = doc.SelectSingleNode("//proj:Compile[@Include=\"" + Path.GetFileName(node.FileName) + "\"]", nsmgr);
				if (docNode != null) {
					d[node] = docNode;
					docNode.ParentNode.RemoveChild(docNode);
				}
			}
			var itemNode = doc.SelectSingleNode("//proj:ItemGroup", nsmgr);
			foreach (FileNode node in getFileNodes(nodes)) {
				XmlNode xmlElem;
				if (d.TryGetValue(node, out xmlElem))
					itemNode.AppendChild(xmlElem);
			}
			
			SaveProjectXml(doc, project as FSharpProject);
		}
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GrhTreeViewFolderNode"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="subCategory">The sub category.</param>
 GrhTreeViewFolderNode(TreeNodeCollection parent, string subCategory)
 {
     _subCategory = subCategory;
     Name = FullCategory;
     parent.Add(this);
     Text = SubCategory;
 }
Esempio n. 25
0
        /// <summary>
        /// 选中装载流程类型
        /// </summary>
        /// <param name="key"></param>
        /// <param name="startNodes"></param>
        public static void LoadWorkFlowClassSelectNode(string key, TreeNodeCollection startNodes)
        {
            try
            {
                DataTable table = WorkFlowClass.GetChildWorkflowClass(key);

                
                foreach (DataRow row in table.Rows)
                {
                    WorkFlowClassTreeNode tmpNode = new WorkFlowClassTreeNode();
                    tmpNode.NodeId = row["WFClassId"].ToString();
                    tmpNode.ImageIndex = 0;
                    tmpNode.ToolTipText = "分类";
                    tmpNode.SelectedImageIndex = 0;
                    tmpNode.clLevel = Convert.ToInt16(row["clLevel"]);
                    tmpNode.Text = row["Caption"].ToString();
                    tmpNode.WorkflowFatherClassId = row["FatherId"].ToString();
                    tmpNode.Description = row["Description"].ToString();
                    tmpNode.MgrUrl = row["clmgrurl"].ToString();
                    tmpNode.NodeType = WorkConst.WORKFLOW_CLASS;
                    startNodes.Add(tmpNode);

                    

                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
 public void fromTreeNodeListCalculateRulesToAdd_recursive(TreeNodeCollection tncTreeNodes,
                                                           List<String> lsRulesToAdd, CirData fadCirData)
 {
     foreach (TreeNode tnTreeNode in tncTreeNodes)
     {
         if (fadCirData.dClasses_bySignature.ContainsKey(tnTreeNode.Text))
         {
             ICirClass ccCirClass = fadCirData.dClasses_bySignature[tnTreeNode.Text];
             foreach (ICirFunction cfCirFunction in ccCirClass.dFunctions.Values)
                 foreach (TreeNode tnChildNode in tnTreeNode.Nodes)
                 {
                     String sGetterVersion = tnChildNode.Text.Replace("set", "get");
                     if (new FilteredSignature(cfCirFunction.FunctionSignature).sFunctionName == sGetterVersion)
                     {
                         if (false == lsRulesToAdd.Contains(cfCirFunction.FunctionSignature))
                             lsRulesToAdd.Add(cfCirFunction.FunctionSignature);
                     }
                     if (tnChildNode.Nodes.Count > 0)
                         fromTreeNodeListCalculateRulesToAdd_recursive(tnChildNode.Nodes, lsRulesToAdd,
                                                                       fadCirData);
                 }
         }
         //   String sClass = tnTreeNode.Text;
     }
 }
Esempio n. 27
0
 private static void createProtocol(TreeNodeCollection tree, Block data)
 {
     Block temp = null;
     foreach (TreeNode t in tree)
     {
         if (t.Name.Equals("block"))
         {
             temp = data.addBlock(t.Text, t.ImageKey, t.SelectedImageKey);
             createProtocol(t.Nodes, temp);
         }
         else
         {
             if (t.Name.Equals("multi"))
             {
                 Field f = data.addField(t.Text, t.Name, "", t.SelectedImageKey);
                 string[] values = t.ImageKey.Split(';');
                 foreach (string s in values)
                 {
                     string[] pair = s.Split(':');
                     ((MultiField)f).addKey(pair[0], pair[1]);
                 }
             }
             else data.addField(t.Text, t.Name, t.ImageKey, t.SelectedImageKey);
         }
     }
 }
 public static ArrayList HoleAlleAusgewaehltenEmpfaengerIDs(TreeNodeCollection pin_TreeNode)
 {
     // neue leere Arraylist
     ArrayList pout_AL = new ArrayList();
     // gehe durch alle enthaltenen Knoten
     if (pin_TreeNode.Count != 0)
     {
         foreach(TreeNode tn in pin_TreeNode)
         {
             // gehe durch alle in diesem enthaltenen Knoten Knoten
             if (tn.Nodes != null)
             {
                 ArrayList tmp = HoleAlleAusgewaehltenEmpfaengerIDs(tn.Nodes);
                 if (tmp != null)
                 {
                     // füge Rückgabewerte der aktuellen ArrayList hinzu
                     pout_AL.AddRange(tmp);
                 }
             }
             // prüfe, ob ein Tag-Value existiert
             if (tn.Tag != null)
                 // prüfe, ob das Element ausgewählt wurde
                 if(tn.Checked)
                 {
                     // hole die PelsObject.ID und speichere diese in der ArrayList
                     pout_AL.Add(((Cdv_pELSObject) tn.Tag).ID);
                 }
         }
     }
     else
     {
     }
     return pout_AL;
 }
Esempio n. 29
0
        private void AddSubMenuItems(System.Windows.Forms.TreeNodeCollection parentCollection, MenuItem parent)
        {
            /* foreach (TreeNode item in parentCollection)
             * {
             *   ToolMenuItemProperty menuItemProperty = (ToolMenuItemProperty)item.Tag;
             *   ToolSubMenuItem newSubMenuItem = new ToolSubMenuItem();
             *   newSubMenuItem.ID = menuItemProperty.UniqueID;
             *   newSubMenuItem.Text = menuItemProperty.Text;
             *   newSubMenuItem.Align = menuItemProperty.Align;
             *
             *   parent.SubMenu.ID = Utils.GetUniqueID("AME_");
             *   parent.SubMenu.SubMenuItems.Add(newSubMenuItem);
             *
             *   if (item.Nodes.Count > 0)
             *       AddSubMenuItems(item.Nodes, newSubMenuItem);
             * }*/

            foreach (System.Windows.Forms.TreeNode item in parentCollection)
            {
                MenuItemProperty menuItemProperty = (MenuItemProperty)item.Tag;
                MenuItem         newMenuItem      = new MenuItem();
                newMenuItem.ID    = menuItemProperty.UniqueID;
                newMenuItem.Text  = menuItemProperty.Text;
                newMenuItem.Align = menuItemProperty.Align;

                parent.SubMenu.ID = Utils.GetUniqueID("AME_");
                parent.SubMenu.Items.Add(newMenuItem);

                if (item.Nodes.Count > 0)
                {
                    AddSubMenuItems(item.Nodes, newMenuItem);
                }
            }
        }
Esempio n. 30
0
        public HxS(string workingDir, string hxsFile,
            string title, string copyright, string locale,
            TreeNodeCollection nodes,
            Content contentDataSet,
            Dictionary<string, string> links)
        {
            this.locale = locale;
            this.title = title;
            this.copyright = copyright;
            this.nodes = nodes;
            this.contentDataSet = contentDataSet;
            this.links = links;

            this.outputFile = Path.GetFullPath(hxsFile);
            this.rawDir = Path.Combine(workingDir, "raw");

            // The source shouldn't be hidden away. If an error happens (likely) the user needs to check logs etc.
            //this.hxsDir = Path.Combine(workingDir, "hxs");
            this.hxsDir = GetUniqueDir(hxsFile);
            this.withinHxsDir = Path.Combine(hxsDir, hxsSubDir);
            this.baseFilename = Path.GetFileNameWithoutExtension(hxsFile);
            this.baseFilename = this.baseFilename.Replace(" ", "_");  //replace spaces with _ otherwise we get compile errors

            this.logFile = Path.Combine(hxsDir, this.baseFilename + ".log");
            this.projectFile = Path.Combine(hxsDir, baseFilename + ".hxc");

            if (xform == null)
            {
                xform = new XslCompiledTransform(true);
                xform.Load(transformFile);
            }
        }
		public void Init()
		{
			List<CodeCoverageModule> modules = new List<CodeCoverageModule>();
			CodeCoverageModule fooModule = new CodeCoverageModule("Foo.Tests");
			CodeCoverageMethod fooTestMethod = new CodeCoverageMethod("FooTest", "Foo.Tests.FooTestFixture");
			fooTestMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTestFixture.cs", 0, 1, 0, 2, 1, 1));
			fooTestMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTestFixture.cs", 0, 2, 2, 3, 4, 1));

			fooModule.Methods.Add(fooTestMethod);
					
			modules.Add(fooModule);
			
			using (CodeCoverageTreeView treeView = new CodeCoverageTreeView()) {
				treeView.AddModules(modules);
				nodes = treeView.Nodes;
			}
			
			fooModuleNode = (CodeCoverageModuleTreeNode)nodes[0];
			
			fooModuleNode.Expanding();
			fooNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooModuleNode.Nodes[0];
			
			fooNamespaceTreeNode.Expanding();
			fooTestsNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooNamespaceTreeNode.Nodes[0];
			
			fooTestsNamespaceTreeNode.Expanding();
			fooTestFixtureTreeNode = (CodeCoverageClassTreeNode)fooTestsNamespaceTreeNode.Nodes[0];
			
			fooTestFixtureTreeNode.Expanding();
			fooTestMethodTreeNode = (CodeCoverageMethodTreeNode)fooTestFixtureTreeNode.Nodes[0];
		}
        private void AddSourceNodeToRoot(Guid source, TreeNodeCollection coll)
        {
            var node = new TreeNode
                           {
                               Name = source.ToString(),
                               Text = source.ToString()
                           };

            node.ContextMenu = new ContextMenu(
                new[]
                    {
                        new MenuItem("Delete",
                                     (sender, args) =>
                                         {
                                             var senderNode = ((sender as MenuItem).Parent.Tag as TreeNode);
                                             if (senderNode.Nodes.Count > 0)
                                             {
                                                 MessageBox.Show("Nodes containing events cannot be deleted.");
                                                 return;
                                             }
                                             store.RemoveEmptyEventSource(Guid.Parse(node.Name));
                                             senderNode.Remove();
                                         }
                            )
                    }
                ) { Tag = node };

            coll.Add(node);

            var events = store.GetAllEvents(source);
            foreach (var evt in events)
            {
                AddEvtNodeToSourceNode(evt, node);
            }
        }
Esempio n. 33
0
        void PopulateNodes(System.Windows.Forms.TreeNodeCollection nodes, ITreeStore item)
        {
            nodes.Clear();
            var count = item.Count;

            for (int i = 0; i < count; i++)
            {
                var child = item[i];
                var node  = nodes.Add(child.Key, child.Text, GetImageKey(child.Image));
                node.Tag = child;

                if (child.Expandable)
                {
                    if (child.Expanded)
                    {
                        PopulateNodes(node.Nodes, child);
                        node.Expand();
                    }
                    else
                    {
                        node.Nodes.Add(EmptyName, string.Empty);
                    }
                }
            }
        }
Esempio n. 34
0
 private void OnRemoveButtonClick()
 {
     this.ValidatePropertyGrid();
     System.Windows.Forms.TreeNode selectedNode = this._treeView.SelectedNode;
     if (selectedNode != null)
     {
         System.Windows.Forms.TreeNodeCollection nodes = null;
         if (selectedNode.Parent != null)
         {
             nodes = selectedNode.Parent.Nodes;
         }
         else
         {
             nodes = this._treeView.Nodes;
         }
         if (nodes.Count == 1)
         {
             this._treeView.SelectedNode = selectedNode.Parent;
         }
         else if (selectedNode.NextNode != null)
         {
             this._treeView.SelectedNode = selectedNode.NextNode;
         }
         else
         {
             this._treeView.SelectedNode = selectedNode.PrevNode;
         }
         selectedNode.Remove();
         if (this._treeView.SelectedNode == null)
         {
             this._propertyGrid.SelectedObject = null;
         }
         this.UpdateEnabledState();
     }
 }
Esempio n. 35
0
 /// <summary>
 /// Adds an options node to the options tree.
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 private int AddNode(WinForms.TreeNodeCollection collection, IOptions options)
 {
     WinForms.TreeNode node = new WinForms.TreeNode(options.NodeName);
     node.Tag = options;
     collection.Add(node);
     return(this.nodesList.Add(options));
 }
Esempio n. 36
0
        /// <summary>
        /// Creates a Facet object from a collection of tree nodes
        /// </summary>
        /// <param name="nodes">The TreeNodeCollection used as source for this Facet object</param>
        /// <param name="name">The map file index corresponding to this facet</param>
        /// <returns>A Facet object representing the nodes collection</returns>
        public static Facet FromTreeNodes( TreeNodeCollection nodes, byte name )
        {
            Facet facet = new Facet();

            facet.MapValue = name;

            foreach ( TreeNode CatNode in nodes )
            {
                GenericNode Category = new GenericNode( CatNode.Text );

                foreach ( TreeNode SubNode in CatNode.Nodes )
                {
                    GenericNode Subsection = new GenericNode( SubNode.Text );
                    // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
                    Subsection.Elements = (List<object>)SubNode.Tag;
                    // Issue 10 - End

                    Category.Elements.Add( Subsection );
                }

                facet.m_Nodes.Add( Category );
            }

            return facet;
        }
 /// <summary>
 /// setzt Häkchen bei allen Elementen deren ID in der übergebenen
 /// ID-Menge enthalten ist
 /// </summary>
 /// <param name="pin_TreeNode"></param>
 /// <param name="pin_IDMenge"></param>
 public static void SetzeAlleAusgewaehltenEmpfaenger(
     TreeNodeCollection pin_TreeNode, int[] pin_IDMenge)
 {
     if (pin_IDMenge != null)
         // gehe durch alle enthaltenen Knoten
         if (pin_TreeNode.Count != 0)
         {
             foreach(TreeNode tn in pin_TreeNode)
             {
                 tn.Checked = false;
                 // gehe durch alle in diesem enthaltenen Knoten Knoten
                 if (tn.Nodes != null)
                 {
                     SetzeAlleAusgewaehltenEmpfaenger(tn.Nodes, pin_IDMenge);
                 }
                 // prüfe, ob ein Tag-Value existiert
                 if (tn.Tag != null)
                     // prüfe, ob das Element ausgewählt wurde
                     foreach(int ID in pin_IDMenge)
                     {
                         if (((Cdv_pELSObject)tn.Tag).ID == ID)
                         {
                             tn.Checked = true;
                         }
                     }
             }
         }
 }
Esempio n. 38
0
        /// <summary>
        /// Adds a virtual file system item to the tree view.
        /// </summary>
        /// <param name="p_tndRoot">The node to which to add the new item.</param>
        /// <param name="p_strName">The name of the new virtual item to add.</param>
        /// <returns>The new tree node representing the new virtual file system item.</returns>
        public FileSystemTreeNode AddVirtualNode(FileSystemTreeNode p_tndRoot, string p_strName)
        {
            if ((p_tndRoot != null) && !p_tndRoot.IsDirectory)
            {
                return(AddVirtualNode(p_tndRoot.Parent, p_strName));
            }
            FileSystemTreeNode tndFile = null;

            System.Windows.Forms.TreeNodeCollection tncSiblings = (p_tndRoot == null) ? this.Nodes : p_tndRoot.Nodes;
            if (!tncSiblings.ContainsKey(p_strName))
            {
                tndFile = (FileSystemTreeNode)tncSiblings[p_strName];
            }
            else
            {
                string strName = Path.GetFileName(p_strName);
                if (String.IsNullOrEmpty(strName))
                {
                    strName = p_strName;
                }
                tndFile      = new FileSystemTreeNode(strName, null);
                tndFile.Name = p_strName;
                tncSiblings.Add(tndFile);
                OnNodeAdded(new NodesChangedEventArgs(tndFile));
            }
            return(tndFile);
        }
		public void SetUp()
		{
			solution = new Solution();
			
			// Create a project to display in the test tree view.
			project = new MockCSharpProject(solution, "TestProject");
			ReferenceProjectItem nunitFrameworkReferenceItem = new ReferenceProjectItem(project);
			nunitFrameworkReferenceItem.Include = "NUnit.Framework";
			ProjectService.AddProjectItem(project, nunitFrameworkReferenceItem);
			
			// Add a test class with a TestFixture attributes.
			projectContent = new MockProjectContent();
			projectContent.Language = LanguageProperties.None;
			testClass1 = new MockClass(projectContent, "Project.Tests.MyTestFixture");
			testClass1.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(testClass1);
			
			testClass2 = new MockClass(projectContent, "Project.MyTestFixture");
			testClass2.Attributes.Add(new MockAttribute("TestFixture"));
			projectContent.Classes.Add(testClass2);
						
			testFrameworks = new MockTestFrameworksWithNUnitFrameworkSupport();
			dummyTreeView = new DummyParserServiceTestTreeView(testFrameworks);
			dummyTreeView.ProjectContentForProject = projectContent;
			
			// Load the projects into the test tree view.
			treeView = dummyTreeView as TestTreeView;
			solution.Folders.Add(project);
			treeView.AddSolution(solution);
			nodes = treeView.Nodes;
			rootNode = (ExtTreeNode)treeView.Nodes[0];
			
			treeView.SelectedNode = rootNode;
			testProject = treeView.SelectedTestProject;
		}
Esempio n. 40
0
        private static void AddNodes(TreeNodeCollection treeNodes, RegexNode regexNode)
        {
            var treeNode = treeNodes.Add(
                regexNode.Id.ToString(CultureInfo.InvariantCulture),
                string.Format("{0} - {1}", regexNode.Pattern, regexNode.NodeType));

            if (regexNode is LeafNode)
            {
                return;
            }

            var wrapperNode = regexNode as WrapperNode;
            if (wrapperNode != null)
            {
                AddNodes(treeNode.Nodes, (wrapperNode).Child);
            }

            var containerNode = regexNode as ContainerNode;
            if (containerNode != null)
            {
                foreach (var child in (containerNode).Children)
                {
                    AddNodes(treeNode.Nodes, child);
                }
            }

            var alternation = regexNode as Alternation;
            if (alternation != null)
            {
                foreach (var choice in (alternation).Choices)
                {
                    AddNodes(treeNode.Nodes, choice);
                }
            }
        }
Esempio n. 41
0
		internal TreeNode FindNodeByFullPathInt(TreeNodeCollection nodes, String fullPath)
		{
			int pathSep = fullPath.IndexOf(PathSeparator);
			String partPath;
			if (pathSep == -1)
				partPath = fullPath;
			else
				partPath = fullPath.Substring(0, pathSep);
			
			foreach (TreeNode node in nodes)
			{
				if (node.Text.Equals(partPath))
				{
					// We are at the bottom
					if (pathSep == -1)
						return node;
					String restPath = fullPath.Substring
						(PathSeparator.Length + pathSep);
					return FindNodeByFullPathInt(node.Nodes,
												restPath);
				}
			}
			// Not found
			return null;
		}
		public void Sort(TreeNodeCollection col)
		{
			CheckDisposed();

			if (col.Count == 0)
				return;
			List<FeatureTreeNode> list = new List<FeatureTreeNode>(col.Count);
			foreach (FeatureTreeNode childNode in col)
			{
				list.Add(childNode);
			}
			list.Sort();

			BeginUpdate();
			col.Clear();
			foreach (FeatureTreeNode childNode in list)
			{
				col.Add(childNode);
				if (childNode.Nodes.Count > 0)
				{
					if (childNode.Nodes[0].Nodes.Count > 0)
						Sort(childNode.Nodes); // sort all but terminal nodes
					else
					{ // append "none of the above" node to terminal nodes
						FeatureTreeNode noneOfTheAboveNode = new FeatureTreeNode(
							// REVIEW: SHOULD THIS STRING BE LOCALIZED?
							LexTextControls.ksNoneOfTheAbove,
							(int)ImageKind.radio, (int)ImageKind.radio, 0,
							FeatureTreeNodeInfo.NodeKind.Other);
						InsertNode(noneOfTheAboveNode, childNode);
					}
				}
			}
			EndUpdate();
		}
 protected override TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool isFile, bool addDummyNode, bool isSpecialFolder)
 {
     if (isFile && _hideFileExention)
     {
         text = System.IO.Path.GetFileNameWithoutExtension(path);
     }
     return(base.CreateTreeNode(parentCollection, parentNode, text, path, isFile, addDummyNode, isSpecialFolder));
 }
Esempio n. 44
0
 public static void AddTreeNode(string str, int cls, System.Windows.Forms.TreeNodeCollection nodes)
 {
     System.Windows.Forms.TreeNode nodeTemp = new System.Windows.Forms.TreeNode();
     nodeTemp.Text               = str;
     nodeTemp.ImageIndex         = cls;
     nodeTemp.SelectedImageIndex = cls;
     nodes.Add(nodeTemp);
 }
 public static System.Windows.Forms.TreeNode AddNode(System.Windows.Forms.TreeNodeCollection parentNodes, string text, int imageIndex, object tag)
 {
     System.Windows.Forms.TreeNode n = parentNodes.Add(text);
     n.ImageIndex         = imageIndex;
     n.SelectedImageIndex = imageIndex;
     n.Tag = tag;
     return(n);
 }
        private void DesChequearMenu(System.Windows.Forms.TreeNodeCollection mNode)
        {
            int i = 0;

            for (i = 0; i < mNode.Count; i++)
            {
                mNode[i].Checked = false;
                DesChequearMenu(mNode[i].Nodes);
            }
        }
Esempio n. 47
0
        void ClearCresTv(System.Windows.Forms.TreeNodeCollection nodes)
        {
            foreach (System.Windows.Forms.TreeNode n in nodes)
            {
                n.Tag = null;
                ClearCresTv(n.Nodes);
            }

            nodes.Clear();
        }
Esempio n. 48
0
        public static List <System.Windows.Forms.TreeNode> ToList(this System.Windows.Forms.TreeNodeCollection Nodes)
        {
            List <TreeNode> subs = new List <TreeNode>();

            foreach (TreeNode sub in Nodes)
            {
                subs.Add(sub);
            }
            return(subs);
        }
Esempio n. 49
0
 private void updateSelectedFates(System.Windows.Forms.TreeNodeCollection nodes)
 {
     foreach (System.Windows.Forms.TreeNode node in nodes)
     {
         if (node.Checked)
         {
             SelectedFates.Push((string)node.Tag);
         }
         updateSelectedFates(node.Nodes);
     }
 }
Esempio n. 50
0
 private void DisposeDiffNodeTag(System.Windows.Forms.TreeNodeCollection treeNodeCollection)
 {
     foreach (var c in treeNodeCollection)
     {
         if ((c as TreeNode).Tag is IDisposable)
         {
             ((c as TreeNode).Tag as IDisposable).Dispose();
         }
         DisposeDiffNodeTag((c as TreeNode).Nodes);
     }
 }
Esempio n. 51
0
 private void uiComboTreeView2_NodesSelected(object sender, System.Windows.Forms.TreeNodeCollection nodes)
 {
     //返回的nodes为TreeView的所有节点,需循环判断
     foreach (TreeNode item in nodes)
     {
         if (item.Checked)
         {
             Console.WriteLine(item.ToString());
         }
     }
 }
Esempio n. 52
0
        IEnumerable <swf.TreeNode> EnumerateNodes(swf.TreeNodeCollection nodes)
        {
            foreach (swf.TreeNode node in nodes)
            {
                yield return(node);

                foreach (var child in EnumerateNodes(node.Nodes))
                {
                    yield return(child);
                }
            }
        }
Esempio n. 53
0
 void PopulateNodes(System.Windows.Forms.TreeNodeCollection nodes, ITreeStore item)
 {
     if (Widget.Loaded)
     {
         ignoreExpandCollapseEvents = true;
     }
     PerformPopulateNodes(nodes, item);
     if (Widget.Loaded)
     {
         ignoreExpandCollapseEvents = false;
     }
 }
Esempio n. 54
0
        /// <summary>
        /// Raises the <see cref="Control.DragDrop"/>.
        /// </summary>
        /// <remarks>
        /// This handles adding the dropped file/folder to the source tree.
        /// </remarks>
        /// <param name="e">A <see cref="DragEventArgs"/> that describes the event arguments.</param>
        protected override void OnDragDrop(DragEventArgs e)
        {
            base.OnDragDrop(e);

            Cursor crsOldCursor = Cursor;

            Cursor = Cursors.WaitCursor;
            BeginUpdate();
            FileSystemTreeNode tndFolder = (FileSystemTreeNode)GetNodeAt(PointToClient(new Point(e.X, e.Y)));

            if ((tndFolder != null) && !tndFolder.IsDirectory)
            {
                tndFolder = tndFolder.Parent;
            }
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] strFileNames = (string[])e.Data.GetData(DataFormats.FileDrop);
                if (strFileNames != null)
                {
                    if (tndFolder != null)
                    {
                        AddPaths(tndFolder, strFileNames);
                        tndFolder.Expand();
                    }
                    else
                    {
                        AddPaths(null, strFileNames);
                    }
                }
            }
            else if (e.Data.GetDataPresent(typeof(List <FileSystemTreeNode>)))
            {
                List <FileSystemTreeNode> lstNodes = ((List <FileSystemTreeNode>)e.Data.GetData(typeof(List <FileSystemTreeNode>)));
                System.Windows.Forms.TreeNodeCollection tncSiblings = null;
                if (tndFolder == null)
                {
                    tncSiblings = Nodes;
                }
                else
                {
                    tncSiblings = tndFolder.Nodes;
                    tndFolder.Expand();
                }
                for (Int32 i = 0; i < lstNodes.Count; i++)
                {
                    lstNodes[i].Remove();
                    tncSiblings.Add(lstNodes[i]);
                }
            }
            EndUpdate();
            Cursor = crsOldCursor;
        }
Esempio n. 55
0
        private void AddMenuItems(System.Windows.Forms.TreeNodeCollection parentCollection)
        {
            foreach (System.Windows.Forms.TreeNode child in parentCollection)
            {
                MenuItemProperty menuItemProperty = (MenuItemProperty)child.Tag;
                MenuItem         newMenuItem      = new MenuItem();
                newMenuItem.ID   = menuItemProperty.UniqueID;
                newMenuItem.Text = menuItemProperty.Text;
                if (menuItemProperty.Align != HorizontalAlign.NotSet)
                {
                    newMenuItem.Align = menuItemProperty.Align;
                }
                if (menuItemProperty.Height.Value > 0)
                {
                    newMenuItem.Height = menuItemProperty.Height;
                }
                if (menuItemProperty.Width.Value > 0)
                {
                    newMenuItem.Width = menuItemProperty.Width;
                }
                newMenuItem.SubMenu.ID = Utils.GetUniqueID("AME_");
                if (menuItemProperty.Image != string.Empty)
                {
                    newMenuItem.Image = menuItemProperty.Image;
                }
                if (menuItemProperty.ImageOver != string.Empty)
                {
                    newMenuItem.ImageOver = menuItemProperty.ImageOver;
                }
                if (menuItemProperty.NavigateURL != string.Empty)
                {
                    newMenuItem.NavigateURL = menuItemProperty.NavigateURL;
                }
                if (menuItemProperty.Target != string.Empty)
                {
                    newMenuItem.Target = menuItemProperty.Target;
                }
                if (menuItemProperty.OnClickClient != string.Empty)
                {
                    newMenuItem.OnClickClient = menuItemProperty.OnClickClient;
                }

                _menu.MenuItems.Add(newMenuItem);

                if (child.Nodes.Count > 0)
                {
                    AddSubMenu(child.Nodes, newMenuItem);
                }
            }
        }
        /// <summary>
        /// Creates a new node and assigns an icon
        /// </summary>
        protected virtual TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool isFile, bool addDummyNode, bool isSpecialFolder)
        {
            TreeNodePath node = Helper.CreateTreeNode(parentCollection != null ? parentCollection : parentNode.Nodes, parentNode, text, path, addDummyNode, false, isSpecialFolder);

            try
            {
                SetIcon(Helper.TreeView, node);
            }
            catch
            {
                node.ImageIndex         = -1;
                node.SelectedImageIndex = -1;
            }
            return(node);
        }
 private void RefreshTree(ItemCollection items,
                          System.Windows.Forms.TreeNodeCollection nodes)
 {
     foreach (System.Windows.Forms.TreeNode node in nodes)
     {
         var item  = new TreeViewItem();
         var label = new Label();
         label.LayoutTransform = new RotateTransform(180);
         label.Content         = node.Text;
         label.Padding         = new Thickness(0);
         item.Header           = label;
         items.Add(item);
         RefreshTree(item.Items, node.Nodes);
     }
 }
Esempio n. 58
0
 private void LoadNodes(System.Windows.Forms.TreeNodeCollection destNodes, System.Web.UI.WebControls.MenuItemCollection sourceNodes)
 {
     foreach (System.Web.UI.WebControls.MenuItem item in sourceNodes)
     {
         MenuItemContainer node = new MenuItemContainer();
         destNodes.Add(node);
         node.Text = item.Text;
         System.Web.UI.WebControls.MenuItem clone = (System.Web.UI.WebControls.MenuItem)((ICloneable)item).Clone();
         this._menuDesigner.RegisterClone(item, clone);
         node.WebMenuItem = clone;
         if (item.ChildItems.Count > 0)
         {
             this.LoadNodes(node.Nodes, item.ChildItems);
         }
     }
 }
Esempio n. 59
0
 private void LoadNodes(System.Windows.Forms.TreeNodeCollection destNodes, System.Web.UI.WebControls.TreeNodeCollection sourceNodes)
 {
     foreach (System.Web.UI.WebControls.TreeNode node in sourceNodes)
     {
         TreeNodeContainer container = new TreeNodeContainer();
         destNodes.Add(container);
         container.Text = node.Text;
         System.Web.UI.WebControls.TreeNode clone = (System.Web.UI.WebControls.TreeNode)((ICloneable)node).Clone();
         this._treeViewDesigner.RegisterClone(node, clone);
         container.WebTreeNode = clone;
         if (node.ChildNodes.Count > 0)
         {
             this.LoadNodes(container.Nodes, node.ChildNodes);
         }
     }
 }
Esempio n. 60
0
 override public System.Windows.Forms.TreeNode AddNode(System.Windows.Forms.TreeNodeCollection Nodes, System.Windows.Forms.TreeNode NewNode)
 {
     if (Nodes.Equals(tree.Nodes) && (NewNode.Tag != null))
     {
         //searches the right node into which do the additon
         //DataRow R = ((tree_node) NewNode.Tag).Row;
         foreach (System.Windows.Forms.TreeNode N in Nodes)
         {
             if (N.Text == "E/P")
             {
                 return(base.AddNode(N.Nodes, NewNode));
             }
         }
     }
     return(base.AddNode(Nodes, NewNode));
 }