System.Windows.Forms.TreeNodeCollection.Add(System.Windows.Forms.TreeNode)

Here are the examples of the csharp api System.Windows.Forms.TreeNodeCollection.Add(System.Windows.Forms.TreeNode) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

630 Examples 7

19 View Source File : ModelView.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

private void AddModelGroup(List<ModelNode> group, TreeNode node)
        {
            int index = 1;
            foreach (var child in group)
            {
                TreeNode newNode = node.Nodes.Add(child.Name + " " + index);
                newNode.Tag = child;

                if (child.Children.Count > 0)
                {
                    AddModelGroup(child.Children, newNode);
                }

                index++;
            }
        }

19 View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : ahmed605

private void CreateDirectoryNode(TreeNode node, Directory dir)
        {
            node.Tag = dir;

            foreach (var item in dir)
            {
                if (item.IsDirectory)
                {
                    Directory subdir = item as Directory;
                    TreeNode subnode = node.Nodes.Add(subdir.Name);
                    CreateDirectoryNode(subnode, subdir);
                }
            }
        }

19 View Source File : TreeNodeCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new osf.TreeNode Add(object p1)
        {
            if (p1 is TreeNode)
            {
                M_TreeNodeCollection.Add((System.Windows.Forms.TreeNode)((TreeNode)p1).M_TreeNode);
                System.Windows.Forms.Application.DoEvents();
                return (TreeNode)p1;
            }
            TreeNode TreeNode1 = new TreeNode();
            TreeNode1.Text = Convert.ToString(p1);
            M_TreeNodeCollection.Add((System.Windows.Forms.TreeNode)((TreeNode)TreeNode1).M_TreeNode);
            System.Windows.Forms.Application.DoEvents();
            return TreeNode1;
        }

19 View Source File : AccountInfo.cs
License : GNU Affero General Public License v3.0
Project Creator : alexander-pick

private void addNode(XmlNode inXmlNode, TreeNode inTreeNode)
    {
      XmlNode xNode;
      TreeNode tNode;
      XmlNodeList nodeList;
      int i;

      // Loop through the XML nodes until the leaf is reached.
      // Add the nodes to the TreeView during the looping process.
      if (inXmlNode.HasChildNodes)
      {
        nodeList = inXmlNode.ChildNodes;
        for (i = 0; i <= nodeList.Count - 1; i++)
        {
          xNode = inXmlNode.ChildNodes[i];
          inTreeNode.Nodes.Add(new TreeNode(xNode.Name));
          tNode = inTreeNode.Nodes[i];
          addNode(xNode, tNode);
        }
      }
      else
      {
        // Here you need to pull the data from the XmlNode based on the
        // type of node, whether attribute values are required, and so forth.
        inTreeNode.Text = inXmlNode.OuterXml.Trim();
      }
    }

19 View Source File : ModelView.cs
License : GNU General Public License v3.0
Project Creator : alexgracianoarj

private void AddProject(Project project)
		{
			ModelNode projectNode = new ProjectNode(project);
			Nodes.Add(projectNode);
			projectNode.AfterInitialized();

			SelectedNode = projectNode;
			projectNode.Expand();
			lblAddProject.Visible = false;

			if (project.ItemCount == 1)
			{
				foreach (IProjecreplacedem item in project.Items)
				{
					IDoreplacedent doreplacedent = item as IDoreplacedent;
					if (doreplacedent != null)
						OnDoreplacedentOpening(new DoreplacedentEventArgs(doreplacedent));
				}
			}
			if (project.IsUnreplacedled)
			{
				projectNode.EditLabel();
			}
		}

19 View Source File : TreeDialog.cs
License : GNU General Public License v3.0
Project Creator : alexgracianoarj

protected TreeNode CreateOperationNode(TreeNode parentNode, Operation operation)
		{
			if (parentNode == null)
				throw new ArgumentNullException("parentNode");
			if (operation == null)
				throw new ArgumentNullException("operation");

			TreeNode child = parentNode.Nodes.Add(operation.GetUmlDescription());
			int imageIndex = Icons.GetImageIndex(operation);

			child.Tag = operation;
			child.ImageIndex = imageIndex;
			child.SelectedImageIndex = imageIndex;
			child.ToolTipText = operation.ToString();

			return child;
		}

19 View Source File : DockerImages.cs
License : Apache License 2.0
Project Creator : aloneguid

private void AddImages(IReadOnlyCollection<DockerImage> images, TreeNodeCollection nodes)
      {
         nodes.Clear();

         foreach (DockerImage image in images)
         {
            var node = new TreeNode(image.Name)
            {
               Tag = image
            };

            nodes.Add(node);

            if (image.Children?.Count > 0)
            {
               AddImages(image.Children, node.Nodes);
            }

            node.Expand();
         }
      }

19 View Source File : RepositoryTreeNode.cs
License : Apache License 2.0
Project Creator : AmpScm

internal void Preload(SvnNodeKind kind)
        {
			if (kind == SvnNodeKind.Directory)
			{
				if (Nodes.Count == 0 && _dummy == null)
				{
					_dummy = new RepositoryTreeNode(RawUri, true);
					_dummy.Name = _dummy.Text = "<dummy>";
					Nodes.Add(_dummy);
				}
			}
			else
				_loaded = true;
        }

19 View Source File : RepositoryTreeView.cs
License : Apache License 2.0
Project Creator : AmpScm

private void SortedAddNode(TreeNodeCollection nodeCollection, RepositoryTreeNode newNode)
        {
            int n = 0;
            foreach (RepositoryTreeNode tn in nodeCollection)
            {
                if (StringComparer.OrdinalIgnoreCase.Compare(tn.Text, newNode.Text) >= 0)
                {
                    nodeCollection.Insert(n, newNode);
                    return;
                }
                n++;
            }
            nodeCollection.Add(newNode);
        }

19 View Source File : FileSystemTreeView.cs
License : Apache License 2.0
Project Creator : AmpScm

private TreeNode AddNode(TreeNodeCollection nodes, WCTreeNode child)
        {
            FileSystemTreeNode normalTreeNode = new FileSystemTreeNode(child);
            normalTreeNode.Tag = child;
            normalTreeNode.SelectedImageIndex = normalTreeNode.ImageIndex = child.ImageIndex;
            nodes.Add(normalTreeNode);
            normalTreeNode.Refresh();

            FileSystemTreeNode d = new FileSystemTreeNode("DUMMY");
            normalTreeNode.Nodes.Add(d);
            d.Tag = DummyTag;
            return normalTreeNode;
        }

19 View Source File : CSharpClassesTab.cs
License : MIT License
Project Creator : AndresTraks

private void AddModelNode(ModelNodeDefinition modelNode, TreeNode parentTreeNode)
        {
            if (parentTreeNode == null)
            {
                parentTreeNode = clreplacedTree.Nodes.Add("global");
                parentTreeNode.Expand();
            }
            else
            {
                parentTreeNode = parentTreeNode.Nodes.Add(modelNode.Name);
            }
            SetNodeProperties(modelNode, parentTreeNode);

            foreach (var child in modelNode.Children
                .OrderBy(GetNodeTypeOrder)
                .ThenBy(c => c.Name))
            {
                AddModelNode(child, parentTreeNode);
            }
        }

19 View Source File : CppFilesTab.cs
License : MIT License
Project Creator : AndresTraks

private void RefrereplacedemNodes(IEnumerable<SourceItemDefinition> items, TreeNodeCollection nodes)
        {
            var existingItems = new Dictionary<SourceItemDefinition, TreeNode>();

            int nodeIndex = 0;
            while (nodeIndex < nodes.Count)
            {
                TreeNode node = nodes[nodeIndex];
                var item = items.FirstOrDefault(i => i == node.Tag);
                if (item != null && (showExcludedButton.Checked || !item.IsExcluded))
                {
                    existingItems.Add(item, node);
                    nodeIndex++;
                }
                else
                {
                    node.Remove();
                }
            }

            foreach (SourceItemDefinition item in items)
            {
                if (showExcludedButton.Checked || !item.IsExcluded)
                {
                    TreeNode node;
                    if (!existingItems.TryGetValue(item, out node))
                    {
                        node = nodes.Add(item.Name);
                        node.Tag = item;
                    }
                    SetNodeProperties(item, node);
                    RefrereplacedemNodes(InputFileOrder(item.Children), node.Nodes);
                }
            }
        }

19 View Source File : ThingBrowserControl.cs
License : GNU General Public License v3.0
Project Creator : anotak

public void Setup()
		{
			// Go for all predefined categories
			typelist.Nodes.Clear();
			nodes = new List<TreeNode>();
			foreach(ThingCategory tc in General.Map.Data.ThingCategories)
			{
				// Create category
				TreeNode cn = typelist.Nodes.Add(tc.Name, tc.replacedle);
				if((tc.Color >= 0) && (tc.Color < thingimages.Images.Count)) cn.ImageIndex = tc.Color;
				cn.SelectedImageIndex = cn.ImageIndex;
				foreach(ThingTypeInfo ti in tc.Things)
				{
					// Create thing
					TreeNode n = cn.Nodes.Add(ti.replacedle);
					if((ti.Color >= 0) && (ti.Color < thingimages.Images.Count)) n.ImageIndex = ti.Color;
					n.SelectedImageIndex = n.ImageIndex;
					n.Tag = ti;
					nodes.Add(n);
				}
			}

			doupdatenode = true;
			doupdatetextbox = true;
		}

19 View Source File : SoundEnvironmentPanel.cs
License : GNU General Public License v3.0
Project Creator : anotak

public void AddSoundEnvironment(SoundEnvironment se) 
		{
			TreeNode topnode = new TreeNode(se.Name);
			topnode.Tag = se; //mxd
			TreeNode thingsnode = new TreeNode("Things (" + se.Things.Count + ")");
			TreeNode linedefsnode = new TreeNode("Linedefs (" + se.Linedefs.Count + ")");
			int notdormant = 0;
			int iconindex = BuilderPlug.Me.DistinctColors.IndexOf(se.Color); //mxd
			int topindex = iconindex; //mxd
			bool nodehaswarnings = false; //mxd

			thingsnode.ImageIndex = iconindex; //mxd
			thingsnode.SelectedImageIndex = iconindex; //mxd
			linedefsnode.ImageIndex = iconindex; //mxd
			linedefsnode.SelectedImageIndex = iconindex; //mxd

			// Add things
			foreach(Thing t in se.Things)
			{
				TreeNode thingnode = new TreeNode("Thing " + t.Index);
				thingnode.Tag = t;
				thingnode.ImageIndex = iconindex; //mxd
				thingnode.SelectedImageIndex = iconindex; //mxd
				thingsnode.Nodes.Add(thingnode);

				if(!BuilderPlug.ThingDormant(t))
				{
					notdormant++;
				}
				else
				{
					thingnode.Text += " (dormant)";
				}
			}

			// Set the icon to warning sign and add the tooltip when there are more than 1 non-dormant things
			if(notdormant > 1)
			{
				thingsnode.ImageIndex = warningiconindex;
				thingsnode.SelectedImageIndex = warningiconindex;
				topindex = warningiconindex;

				foreach(TreeNode tn in thingsnode.Nodes)
				{
					if(!BuilderPlug.ThingDormant((Thing)tn.Tag))
					{
						tn.ImageIndex = warningiconindex;
						tn.SelectedImageIndex = warningiconindex;
						tn.ToolTipText = "More than one thing in this\nsound environment is set to be\nactive. Set all but one thing\nto dormant.";
						nodewarningscount++; //mxd
						nodehaswarnings = true; //mxd
					}
				}
			}

			// Add linedefs
			foreach(Linedef ld in se.Linedefs)
			{
				bool showwarning = false;
				TreeNode linedefnode = new TreeNode("Linedef " + ld.Index);
				linedefnode.Tag = ld;
				linedefnode.ImageIndex = iconindex; //mxd
				linedefnode.SelectedImageIndex = iconindex; //mxd

				if(ld.Back == null || ld.Front == null)
				{
					showwarning = true;
					linedefnode.ToolTipText = "This line is single-sided, but has\nthe sound boundary flag set.";
				}
				else if(se.Sectors.Contains(ld.Front.Sector) && se.Sectors.Contains(ld.Back.Sector))
				{
					showwarning = true;
					linedefnode.ToolTipText = "More than one thing in this\nThe sectors on both sides of\nthe line belong to the same\nsound environment.";
				}

				if(showwarning)
				{
					linedefnode.ImageIndex = warningiconindex;
					linedefnode.SelectedImageIndex = warningiconindex;

					linedefsnode.ImageIndex = warningiconindex;
					linedefsnode.SelectedImageIndex = warningiconindex;

					topindex = warningiconindex;
					nodewarningscount++; //mxd
					nodehaswarnings = true; //mxd
				}

				linedefsnode.Nodes.Add(linedefnode);
			}

			//mxd
			if(!showwarningsonly.Checked || nodehaswarnings)
			{
				topnode.Nodes.Add(thingsnode);
				topnode.Nodes.Add(linedefsnode);

				topnode.Tag = se;
				topnode.ImageIndex = topindex;
				topnode.SelectedImageIndex = topindex;

				// Sound environments will no be added in consecutive order, so we'll have to find
				// out where in the tree to add the node
				int insertionplace = 0;

				foreach(TreeNode tn in soundenvironments.Nodes)
				{
					if(se.ID < ((SoundEnvironment)tn.Tag).ID) break;
					insertionplace++;
				}

				soundenvironments.Nodes.Insert(insertionplace, topnode);
			}
		}

19 View Source File : SampleWizardPage.cs
License : MIT License
Project Creator : aspose-pdf

private void GetFiles(DirectoryInfo subDirs,
   TreeNode nodeToAddTo)
        {
            TreeNode aNode;
            ListViewItem item = null;
            foreach (FileInfo file in subDirs.GetFiles())
            {
                if (file.Name.Contains(".cs") || file.Name.Contains(".vb"))
                {
                    aNode = new TreeNode(AddSpacesToSentence(file.Name.Replace(".cs", "").Replace(".vb", "").Replace("-", "")), 0, 0);
                    aNode.Tag = file;
                    aNode.ImageKey = "File";
                    aNode.ImageIndex = (rdbCSharp.Checked ? 1 : 2);
                    aNode.SelectedImageIndex = (rdbCSharp.Checked ? 1 : 2);
                    nodeToAddTo.Nodes.Add(aNode);
                }
            }
            nodeToAddTo.ExpandAll();
        }

19 View Source File : SampleWizardPage.cs
License : MIT License
Project Creator : aspose-pdf

private void GetDirectories(DirectoryInfo[] subDirs,
   TreeNode nodeToAddTo)
        {
            TreeNode aNode;
            DirectoryInfo[] subSubDirs;
            foreach (DirectoryInfo subDir in subDirs)
            {
                if (!subDir.Name.ToLower().Equals("data") && !subDir.Name.ToLower().Equals("properties"))
                {
                    aNode = new TreeNode(AddSpacesToSentence(subDir.Name.Replace("-", "")), 0, 0);
                    aNode.Tag = subDir;
                    aNode.ImageKey = "folder";
                    aNode.ImageIndex = 0;
                    aNode.SelectedImageIndex = 0;
                    subSubDirs = subDir.GetDirectories();

                    if (subDir.GetFiles().Count() > 0)
                    {
                        GetFiles(subDir, aNode);
                    }
                    if (subSubDirs.Length != 0)
                    {
                        GetDirectories(subSubDirs, aNode);
                    }
                    aNode.ExpandAll();
                    nodeToAddTo.Nodes.Add(aNode);
                }
            }
            nodeToAddTo.ExpandAll();
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : Autodesk-Forge

private async Task ShowBucketObjects(TreeNode nodeBucket)
    {
      nodeBucket.Nodes.Clear();

      ObjectsApi objects = new ObjectsApi();
      objects.Configuration.AccessToken = AccessToken;

      // show objects on the given TreeNode
      BucketObjects objectsList = (await objects.GetObjectsAsync((string)nodeBucket.Tag)).ToObject<BucketObjects>();
      foreach (var objInfo in objectsList.Items)
      {
        TreeNode nodeObject = new TreeNode(objInfo.ObjectKey);
        nodeObject.Tag = ((string)objInfo.ObjectId).Base64Encode();
        nodeBucket.Nodes.Add(nodeObject);
      }
    }

19 View Source File : ApplicationManager.cs
License : MIT License
Project Creator : BizTalkCommunity

private void AddBlankApp()
        {

            string appName = copyAppName(_newapplication);
            TreeNode node = new TreeNode(appName);
            TreeNode rootNode = tvApps.TopNode;
            rootNode.Nodes.Add(node);
            tvApps.SelectedNode = node;
            tvApps.LabelEdit = true;
            tvApps.SelectedNode.BeginEdit();
            SSOConfigManager.CreateConfigStoreApplication(appName, "", ContactInfo,
                    AuserAcct, AdminAcct, new SSOPropBag(), new ArrayList());
            InicSearchGrid();
        }

19 View Source File : Utils.cs
License : MIT License
Project Creator : BizTalkCommunity

public static void Search(TreeView tvApps, string searchText, DataGridView dgvSearch)
        {
            tvApps.Nodes.Clear();
            TreeNode rootNode = new TreeNode("Applications");
            tvApps.Nodes.Add(rootNode);

            foreach (var application in SSOConfigManager.GetApplications())
            {
                string appUserAcct, appAdminAcct, description, contactInfo;
                HybridDictionary props = SSOConfigManager.GetConfigProperties(application, out description, out contactInfo,
                    out appUserAcct, out appAdminAcct);
                // search string in all keys and values
                if (!string.IsNullOrWhiteSpace(searchText) &&
                    //!application.Equals(searchText, StringComparison.InvariantCultureIgnoreCase) &&
                    !ContainsIgnoreCase(application,searchText, StringComparison.OrdinalIgnoreCase) &&
                    !SSOConfigManager.SearchKeys(props, searchText) &&
                    !SSOConfigManager.SearchValues(props, searchText)) continue;
                var node = new TreeNode(application) { ToolTipText = description };
                
                // add node if found
                rootNode.Nodes.Add(node);
            }

            TreeNodeCollection nodes = rootNode.Nodes;
            if (nodes.Count > 0)
            {
                // Select the root node
                tvApps.SelectedNode = nodes[0];
                tvApps.SelectedNode.Expand();
                LoadGrid(nodes[0].Text, dgvSearch);
                tvApps.Focus();
            }
        }

19 View Source File : EntityTreeNode.cs
License : MIT License
Project Creator : circles-arrows

internal void LoadInheritance()
        {
            if (loadedInheritance)
                return;

            if (Enreplacedy.Inherits == null)
                return;

            var enreplacedyLookup = Model.Enreplacedies.Enreplacedy.ToDictionary(x => Guid.Parse(x.Guid));

            if (Enreplacedy.Inherits != null)
            {
                enreplacedyLookup.TryGetValue(Guid.Parse(Enreplacedy.Inherits), out Enreplacedy parent);

                while (parent != null)
                {
                    InheritNode.Nodes.Add(new InheritedEnreplacedyTreeNode(Model, parent));

                    if (parent.Inherits == null)
                        break;

                    enreplacedyLookup.TryGetValue(Guid.Parse(parent.Inherits), out parent);
                }
            }

            if (InheritNode.Nodes.Count > 0)
                Nodes.Add(InheritNode);

            InheritNode.Expand();
            InheritNode.Checked = true;
            loadedInheritance = true;
        }

19 View Source File : EntityTreeNode.cs
License : MIT License
Project Creator : circles-arrows

internal void LoadRelationship()
        {
            if (loaded)
                return;

            foreach (Relationship rel in Relationship)
                RelationshipNode.Nodes.Add(new RelationshipTreeNode(Model, rel));

            if (RelationshipNode.Nodes.Count > 0)
                Nodes.Add(RelationshipNode);

            RelationshipNode.Expand();
            RelationshipNode.Checked = true;

            loaded = true;
        }

19 View Source File : FoldersManagerForm.cs
License : GNU General Public License v3.0
Project Creator : ClusterM

void AddNodes(TreeNodeCollection treeNodeCollection, NesMenuCollection nesMenuCollection, List<NesMenuCollection> usedFolders = null)
        {
            if (usedFolders == null)
                usedFolders = new List<NesMenuCollection>();
            if (usedFolders.Contains(nesMenuCollection))
                return;
            usedFolders.Add(nesMenuCollection);
            var sorted = nesMenuCollection.OrderBy(o => o.Name).OrderBy(o => (o is NesMenuFolder) ? (byte)(o as NesMenuFolder).Position : 2);
            foreach (var nesElement in sorted)
            {
                var newNode = new TreeNode();
                if (nesElement is NesMenuFolder)
                {
                    if (usedFolders.Contains((nesElement as NesMenuFolder).ChildMenuCollection))
                    {
                        nesMenuCollection.Remove(nesElement); // We don't need any "back" folders
                        continue;
                    }
                }
                newNode.SelectedImageIndex = newNode.ImageIndex = getImageIndex(nesElement as INesMenuElement);
                newNode.Text = nesElement.Name;
                newNode.Tag = nesElement;
                treeNodeCollection.Add(newNode);
                if (nesElement is NesMenuFolder)
                {
                    AddNodes(newNode.Nodes, (nesElement as NesMenuFolder).ChildMenuCollection, usedFolders);
                }
            }
        }

19 View Source File : FoldersManagerForm.cs
License : GNU General Public License v3.0
Project Creator : ClusterM

private void KostilKostilevich(object o)
        {
            // This is stupid workaround for resort after renaming item, lol
            if (InvokeRequired)
            {
                Invoke(new Action<object>(KostilKostilevich), new object[] { o });
                return;
            }
            if (o is TreeNode)
            {
                var node = o as TreeNode;
                var parent = node.Parent;
                parent.Nodes.Remove(node);
                parent.Nodes.Add(node);
                treeView.SelectedNode = node;
                ShowFolderStats();
            }
            if (o is ListViewItem)
            {
                var item = o as ListViewItem;
                listViewContent.Items.Remove(item);
                listViewContent.Items.Add(item);
                var node = item.Tag as TreeNode;
                var parent = node.Parent;
                parent.Nodes.Remove(node);
                parent.Nodes.Add(node);
            }
        }

19 View Source File : FoldersManagerForm.cs
License : GNU General Public License v3.0
Project Creator : ClusterM

bool MoveToFolder(IEnumerable<TreeNode> newNodes, TreeNode destinationNode, bool showDest = true)
        {
            if (destinationNode == null)
                destinationNode = treeView.Nodes[0]; // Root
            if (destinationNode.Tag is NesMiniApplication || destinationNode.Tag is NesDefaultGame)
                destinationNode = destinationNode.Parent;
            foreach (var newNode in newNodes)
            {
                if (!destinationNode.FullPath.StartsWith(newNode.FullPath + '\\') && (destinationNode != newNode.Parent))
                {
                    Debug.WriteLine(string.Format("Drag: {0}->{1}", newNode, destinationNode));
                    if (newNode.Parent.Tag is NesMenuFolder)
                        (newNode.Parent.Tag as NesMenuFolder).ChildMenuCollection.Remove(newNode.Tag as INesMenuElement);
                    else if (newNode.Parent.Tag is NesMenuCollection)
                        (newNode.Parent.Tag as NesMenuCollection).Remove(newNode.Tag as INesMenuElement);
                    newNode.Parent.Nodes.Remove(newNode);
                    destinationNode.Nodes.Add(newNode);
                    if (destinationNode.Tag is NesMenuFolder)
                        (destinationNode.Tag as NesMenuFolder).ChildMenuCollection.Add(newNode.Tag as INesMenuElement);
                    else if (destinationNode.Tag is NesMenuCollection)
                        (destinationNode.Tag as NesMenuCollection).Add(newNode.Tag as INesMenuElement);
                }
                else
                {
                    System.Media.SystemSounds.Hand.Play();
                    return false;
                }
            }
            if (showDest)
                treeView.SelectedNode = destinationNode;

            if (treeView.SelectedNode == destinationNode)
                ShowSelected();
            else
                foreach (var i in (from n in listViewContent.Items.Cast<ListViewItem>().ToArray() where newNodes.Contains(n.Tag as TreeNode) select n))
                    listViewContent.Items.Remove(i);
            foreach (ListViewItem item in listViewContent.Items)
                item.Selected = newNodes.Contains(item.Tag as TreeNode) || item.Tag == destinationNode;
            ShowFolderStats();
            return true;
        }

19 View Source File : FoldersManagerForm.cs
License : GNU General Public License v3.0
Project Creator : ClusterM

void newFolder(TreeNode parent = null)
        {
            var newFolder = new NesMenuFolder(Resources.FolderNameNewFolder);
            var folderImageIndex = getImageIndex(newFolder);
            var newnode = new TreeNode(Resources.FolderNameNewFolder, folderImageIndex, folderImageIndex);
            newnode.Tag = newFolder;
            if (parent != null)
            {
                parent.Nodes.Add(newnode);
                treeView.SelectedNode = newnode;
                ShowSelected();
                newnode.BeginEdit();
            }
            else if (treeView.SelectedNode != null)
            {
                parent = treeView.SelectedNode;
                parent.Nodes.Add(newnode);
                ShowFolderStats();
                var item = new ListViewItem(newnode.Text, folderImageIndex);
                item.Tag = newnode;
                listViewContent.SelectedItems.Clear();
                listViewContent.Items.Add(item);
                item.BeginEdit();
            }
            if (parent != null)
            {
                if (parent.Tag is NesMenuFolder)
                    (parent.Tag as NesMenuFolder).ChildMenuCollection.Add(newFolder);
                else if (parent.Tag is NesMenuCollection)
                    (parent.Tag as NesMenuCollection).Add(newFolder);
            }
        }

19 View Source File : Test.cs
License : MIT License
Project Creator : codewitch-honey-crisis

void _AddNodes(TreeNode node,ParseNode pt)
		{
			var treeNode = new TreeNode();
			if (null != pt.Value)
			{
				treeNode.Text = string.Concat(pt.Symbol, ": ", pt.Value);
				treeNode.ImageIndex = ("#ERROR"==pt.Symbol)?2:1;
				treeNode.SelectedImageIndex = treeNode.ImageIndex;
				treeNode.Tag = pt;
				node.Nodes.Add(treeNode);
				treeNode.Expand();
			}
			else
			{
				treeNode.Text = pt.Symbol;
				treeNode.Tag = pt;
				foreach (var ptc in pt.Children) {
					_AddNodes(treeNode, ptc);
				}
				node.Nodes.Add(treeNode);
				treeNode.Expand();
			}
		}

19 View Source File : DbTreeView.cs
License : MIT License
Project Creator : CslaGenFork

public void BuildSchemaTree(ICatalog catalog, bool showColumns)
        {
            _showColumns = showColumns;
            TreeViewSchema.Nodes.Clear();
            treeViewSchema.ImageList = schemaImages;
            if (showColumns)
            {
                TreeNode emptyNode = new TreeNode("None");
                emptyNode.ImageIndex = (int)TreeViewIcons.field;
                emptyNode.SelectedImageIndex = (int)TreeViewIcons.field;
                TreeViewSchema.Nodes.Add(emptyNode);
            }
            TreeNode tableBaseNode = null;

            #region  Add Tables
            TreeNode[] tableNodes = new TreeNode[catalog.Tables.Count];
            TreeNode node;
            for (int i = 0; i < catalog.Tables.Count; i++)
            {
                node = new TreeNode();
                tableNodes[i] = node;
                LoadTableNode(node, catalog.Tables[i]);
            }

            if (catalog.Tables.Count > 0)
            {
                Array.Sort(tableNodes, new TreeNodeComparer());
                tableBaseNode = new TreeNode("Tables", tableNodes);
            }
            else
            {
                tableBaseNode = new TreeNode("Tables");
            }
            tableBaseNode.ImageIndex = (int)TreeViewIcons.db;
            tableBaseNode.SelectedImageIndex = (int)TreeViewIcons.db;
            TreeViewSchema.Nodes.Add(tableBaseNode);

            #endregion

            #region Add Views

            TreeNode viewBaseNode;
            TreeNode[] viewNodes = new TreeNode[catalog.Views.Count];

            for (int i = 0; i < catalog.Views.Count; i++)
            {
                node = new TreeNode();
                viewNodes[i] = node;
                LoadViewNode(node, catalog.Views[i]);
            }
            if (catalog.Views.Count > 0)
            {
                Array.Sort(viewNodes, new TreeNodeComparer());
                viewBaseNode = new TreeNode("Views", viewNodes);
            }
            else
            {
                viewBaseNode = new TreeNode("Views");
            }
            viewBaseNode.ImageIndex = (int)TreeViewIcons.db;
            viewBaseNode.SelectedImageIndex = (int)TreeViewIcons.db;

            TreeViewSchema.Nodes.Add(viewBaseNode);

            #endregion

            #region Add Stored Procs

            TreeNode spBaseNode;
            List<TreeNode> spNodes = new List<TreeNode>();
            for (int i = 0; i < catalog.Procedures.Count; i++)
            {
                node = new TreeNode();
                LoadStoredProcedureNode(node, catalog.Procedures[i]);
                spNodes.Add(node);
            }
            if (catalog.Procedures.Count > 0)
            {
                spNodes.Sort(new TreeNodeComparer());
                spBaseNode = new TreeNode("Stored Procedures", spNodes.ToArray());
            }
            else
            {
                spBaseNode = new TreeNode("Stored Procedures");
            }
            spBaseNode.ImageIndex = (int)TreeViewIcons.db;
            spBaseNode.SelectedImageIndex = (int)TreeViewIcons.db;

            TreeViewSchema.Nodes.Add(spBaseNode);

            #endregion
        }

19 View Source File : DbTreeView.cs
License : MIT License
Project Creator : CslaGenFork

void AddColumns(TreeNode node, ColumnInfoCollection cols)
        {
            node.Nodes.Clear();
            foreach (IColumnInfo c in cols)
            {
                TreeNode n = new TreeNode(c.ColumnName);
                n.Tag = c;
                n.SelectedImageIndex = (int)TreeViewIcons.field;
                n.ImageIndex = (int)TreeViewIcons.field;
                if (c.IsPrimaryKey)
                {
                    n.SelectedImageIndex = (int)TreeViewIcons.goldkey;
                    n.ImageIndex = (int)TreeViewIcons.goldkey;
                }
                node.Nodes.Add(n);
            }
        }

19 View Source File : DbTreeView.cs
License : MIT License
Project Creator : CslaGenFork

void AddColumns(TreeNode node, ColumnInfoCollection cols)
        {
            node.Nodes.Clear();
            foreach (IColumnInfo c in cols)
            {
                TreeNode n = new TreeNode(c.ColumnName);
                n.Tag = c;
                n.SelectedImageIndex = (int)TvwIcons.field;
                n.ImageIndex = (int)TvwIcons.field;
                if (c.IsPrimaryKey)
                {
                    n.SelectedImageIndex = (int)TvwIcons.goldkey;
                    n.ImageIndex = (int)TvwIcons.goldkey;
                }
                node.Nodes.Add(n);
            }
        }

19 View Source File : DbTreeView.cs
License : MIT License
Project Creator : CslaGenFork

public void BuildSchemaTree(ICatalog catalog, bool showColumns)
        {
            _showColumns = showColumns;
            TreeViewSchema.Nodes.Clear();
            tvwSchema.ImageList = schemaImages;
            if (showColumns)
            {
                TreeNode emptyNode = new TreeNode("None");
                emptyNode.ImageIndex = (int)TvwIcons.field;
                emptyNode.SelectedImageIndex = (int)TvwIcons.field;
                TreeViewSchema.Nodes.Add(emptyNode);
            }
            TreeNode tableBaseNode = null;

            #region  Add Tables
            TreeNode[] tableNodes = new TreeNode[catalog.Tables.Count];
            TreeNode node;
            for (int i = 0; i < catalog.Tables.Count; i++)
            {
                node = new TreeNode();
                tableNodes[i] = node;
                LoadTableNode(node, catalog.Tables[i]);
            }

            if (catalog.Tables.Count > 0)
            {
                Array.Sort(tableNodes, new TreeNodeComparer());
                tableBaseNode = new TreeNode("Tables", tableNodes);
            }
            else
            {
                tableBaseNode = new TreeNode("Tables");
            }
            tableBaseNode.ImageIndex = (int)TvwIcons.db;
            tableBaseNode.SelectedImageIndex = (int)TvwIcons.db;
            TreeViewSchema.Nodes.Add(tableBaseNode);

            #endregion

            #region Add Views

            TreeNode viewBaseNode;
            TreeNode[] viewNodes = new TreeNode[catalog.Views.Count];

            for (int i = 0; i < catalog.Views.Count; i++)
            {
                node = new TreeNode();
                viewNodes[i] = node;
                LoadViewNode(node, catalog.Views[i]);
            }
            if (catalog.Views.Count > 0)
            {
                Array.Sort(viewNodes, new TreeNodeComparer());
                viewBaseNode = new TreeNode("Views", viewNodes);
            }
            else
            {
                viewBaseNode = new TreeNode("Views");
            }
            viewBaseNode.ImageIndex = (int)TvwIcons.db;
            viewBaseNode.SelectedImageIndex = (int)TvwIcons.db;

            TreeViewSchema.Nodes.Add(viewBaseNode);

            #endregion

            #region Add Stored Procs

            TreeNode spBaseNode;
            List<TreeNode> spNodes = new List<TreeNode>();
            for (int i = 0; i < catalog.Procedures.Count; i++)
            {
                node = new TreeNode();
                LoadStoredProcedureNode(node, catalog.Procedures[i]);
                spNodes.Add(node);
            }
            if (catalog.Procedures.Count > 0)
            {
                spNodes.Sort(new TreeNodeComparer());
                spBaseNode = new TreeNode("Stored Procedures", spNodes.ToArray());
            }
            else
            {
                spBaseNode = new TreeNode("Stored Procedures");
            }
            spBaseNode.ImageIndex = (int)TvwIcons.db;
            spBaseNode.SelectedImageIndex = (int)TvwIcons.db;

            TreeViewSchema.Nodes.Add(spBaseNode);

            #endregion
        }

19 View Source File : DbTreeView.cs
License : MIT License
Project Creator : CslaGenFork

public void BuildSchemaTree(ICatalog catalog, bool showColumns)
        {
            _showColumns = showColumns;
            TreeViewSchema.Nodes.Clear();
            treeViewSchema.ImageList = schemaImages;
            if (showColumns)
            {
                var emptyNode = new TreeNode("None");
                emptyNode.ImageIndex = (int)TreeViewIcons.field;
                emptyNode.SelectedImageIndex = (int)TreeViewIcons.field;
                TreeViewSchema.Nodes.Add(emptyNode);
            }
            TreeNode tableBaseNode = null;

            #region  Add Tables
            TreeNode[] tableNodes = new TreeNode[catalog.Tables.Count];
            TreeNode node;
            for (int i = 0; i < catalog.Tables.Count; i++)
            {
                node = new TreeNode();
                tableNodes[i] = node;
                LoadTableNode(node, catalog.Tables[i]);
            }

            if (catalog.Tables.Count > 0)
            {
                Array.Sort(tableNodes, new TreeNodeComparer());
                tableBaseNode = new TreeNode("Tables", tableNodes);
            }
            else
            {
                tableBaseNode = new TreeNode("Tables");
            }
            tableBaseNode.ImageIndex = (int)TreeViewIcons.db;
            tableBaseNode.SelectedImageIndex = (int)TreeViewIcons.db;
            TreeViewSchema.Nodes.Add(tableBaseNode);

            #endregion

            #region Add Views

            TreeNode viewBaseNode;
            TreeNode[] viewNodes = new TreeNode[catalog.Views.Count];

            for (int i = 0; i < catalog.Views.Count; i++)
            {
                node = new TreeNode();
                viewNodes[i] = node;
                LoadViewNode(node, catalog.Views[i]);
            }
            if (catalog.Views.Count > 0)
            {
                Array.Sort(viewNodes, new TreeNodeComparer());
                viewBaseNode = new TreeNode("Views", viewNodes);
            }
            else
            {
                viewBaseNode = new TreeNode("Views");
            }
            viewBaseNode.ImageIndex = (int)TreeViewIcons.db;
            viewBaseNode.SelectedImageIndex = (int)TreeViewIcons.db;

            TreeViewSchema.Nodes.Add(viewBaseNode);

            #endregion

            #region Add Stored Procs

            TreeNode spBaseNode;
            List<TreeNode> spNodes = new List<TreeNode>();
            for (int i = 0; i < catalog.Procedures.Count; i++)
            {
                node = new TreeNode();
                LoadStoredProcedureNode(node, catalog.Procedures[i]);
                spNodes.Add(node);
            }
            if (catalog.Procedures.Count > 0)
            {
                spNodes.Sort(new TreeNodeComparer());
                spBaseNode = new TreeNode("Stored Procedures", spNodes.ToArray());
            }
            else
            {
                spBaseNode = new TreeNode("Stored Procedures");
            }
            spBaseNode.ImageIndex = (int)TreeViewIcons.db;
            spBaseNode.SelectedImageIndex = (int)TreeViewIcons.db;

            TreeViewSchema.Nodes.Add(spBaseNode);

            #endregion
        }

19 View Source File : DialogDocumentSelector.cs
License : Apache License 2.0
Project Creator : cyanide-studio

private void populateDialogueTreeView(List<Dialogue> inCheckedDialogues)
        {
            var project = ResourcesHandler.Project;

            if (project == null)
                return;

            dialogueTreeView.BeginUpdate();

            foreach (Package package in project.ListPackages)
            {
                TreeNode nodePackage = dialogueTreeView.Nodes.Add(GetPackageKey(package.Name), package.Name);
                nodePackage.Tag = package;
                EditorHelper.SetNodeIcon(nodePackage, ENodeIcon.Package);
            }

            foreach (Dialogue dialogue in ResourcesHandler.GetAllDialogues())
            {
                if (dialogue == null)
                    continue;

                if (dialogue.Package == null)
                    continue;

                TreeNode[] nodePackages = dialogueTreeView.Nodes.Find(GetPackageKey(dialogue.Package.Name), false);
                if (nodePackages.Count() > 0)
                {
                    TreeNode nodeParent = nodePackages[0];

                    string path = dialogue.GetFilePath();
                    string[] folders = path.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
                    string folderPath = "";
                    foreach (string folder in folders)
                    {
                        folderPath = Path.Combine(folderPath, folder);

                        TreeNode[] nodeFolders = nodeParent.Nodes.Find(folder, false);
                        if (nodeFolders.Count() > 0)
                        {
                            nodeParent = nodeFolders[0];
                        }
                        else
                        {
                            nodeParent = nodeParent.Nodes.Add(folder, folder);
                            nodeParent.Tag = new Folder() { Path = folderPath };
                            EditorHelper.SetNodeIcon(nodeParent, ENodeIcon.Folder);
                        }
                    }

                    TreeNode nodeDialogue = nodeParent.Nodes.Add(dialogue.GetFileName(), dialogue.GetName());
                    nodeDialogue.Checked = checkedDialogues.Contains(dialogue);
                    nodeDialogue.Tag = dialogue;
                    EditorHelper.SetNodeIcon(nodeDialogue, ENodeIcon.Dialogue);
                }
            }

            dialogueTreeView.EndUpdate();

            foreach (TreeNode node in dialogueTreeView.Nodes)
            {
                node.Expand();
            }
        }

19 View Source File : FormPropertiesCommon.cs
License : Apache License 2.0
Project Creator : cyanide-studio

private void AddTreeNodeCondition(NodeCondition condition, TreeNode parent)
        {
            TreeNode treeNodeAttribute = parent.Nodes.Add(condition.GetTreeText());
            treeNodeAttribute.ContextMenuStrip = menuAttributes;
            treeNodeAttribute.Tag = condition;

            if (condition is NodeConditionGroup)
            {
                EditorHelper.SetNodeIcon(treeNodeAttribute, ENodeIcon.LisreplacedemConditionGroup);

                foreach (NodeCondition subCondition in ((NodeConditionGroup)condition).Conditions)
                {
                    AddTreeNodeCondition(subCondition, treeNodeAttribute);
                }
            }
            else
            {
                EditorHelper.SetNodeIcon(treeNodeAttribute, ENodeIcon.LisreplacedemCondition);
            }

            parent.ExpandAll();
        }

19 View Source File : FormPropertiesCommon.cs
License : Apache License 2.0
Project Creator : cyanide-studio

private void AddTreeNodeAction(NodeAction action)
        {
            TreeNode treeNodeAttribute = treeNodeRootActions.Nodes.Add(action.GetTreeText());
            treeNodeAttribute.ContextMenuStrip = menuAttributes;
            treeNodeAttribute.Tag = action;
            EditorHelper.SetNodeIcon(treeNodeAttribute, ENodeIcon.LisreplacedemAction);

            treeNodeRootActions.ExpandAll();
        }

19 View Source File : FormPropertiesCommon.cs
License : Apache License 2.0
Project Creator : cyanide-studio

private void AddTreeNodeFlag(NodeFlag flag)
        {
            TreeNode treeNodeAttribute = treeNodeRootFlags.Nodes.Add(flag.GetTreeText());
            treeNodeAttribute.ContextMenuStrip = menuAttributes;
            treeNodeAttribute.Tag = flag;
            EditorHelper.SetNodeIcon(treeNodeAttribute, ENodeIcon.LisreplacedemFlag);

            treeNodeRootFlags.ExpandAll();
        }

19 View Source File : PanelProjectExplorer.cs
License : Apache License 2.0
Project Creator : cyanide-studio

public void ResyncFile(Dialogue dialogue, bool focus)
        {
            if (dialogue == null)
                return;

            if (dialogue.Package == null)
            {
                EditorCore.LogError("Unable to show a Dialogue without Package in project explorer : " + dialogue.GetName());
                return;
            }

            TreeNode[] nodePackages = tree.Nodes.Find(GetPackageKey(dialogue.Package.Name), false);
            if (nodePackages.Count() > 0)
            {
                TreeNode nodeParent = nodePackages[0];

                string path = dialogue.GetFilePath();
                string[] folders = path.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
                string folderPath = "";
                foreach (string folder in folders)
                {
                    folderPath = Path.Combine(folderPath, folder);

                    TreeNode[] nodeFolders = nodeParent.Nodes.Find(folder, false);
                    if (nodeFolders.Count() > 0)
                    {
                        nodeParent = nodeFolders[0];
                    }
                    else
                    {
                        nodeParent = nodeParent.Nodes.Add(folder, folder);
                        nodeParent.Tag = new Folder() { Path = folderPath };
                        nodeParent.ContextMenuStrip = menuFolder;
                        EditorHelper.SetNodeIcon(nodeParent, ENodeIcon.Folder);
                    }
                }

                TreeNode nodeDialogue = nodeParent.Nodes.Add(dialogue.GetFileName(), dialogue.GetName());
                nodeDialogue.ContextMenuStrip = menuDoreplacedent;
                EditorHelper.SetNodeIcon(nodeDialogue, ENodeIcon.Dialogue);

                nodeDialogue.Tag = dialogue;

                if (focus)
                    nodeDialogue.EnsureVisible();
            }
            else
            {
                EditorCore.LogError("Unable to show a Dialogue with unknown Package in project explorer : " + dialogue.GetName() + " in " + dialogue.Package.Name);
            }
        }

19 View Source File : SettingDialog.cs
License : MIT License
Project Creator : d-mod

private void AddConfig(Type type) {
            if (!typeof(AbstractSettingPane).IsreplacedignableFrom(type)) {
                return;
            }
            var control = type.CreateInstance(Connector) as AbstractSettingPane;
            var parentArray = tree.Nodes.Find(control.Parent, false);
            TreeNode parentNode = null;
            if (parentArray.Length > 0) {
                parentNode = parentArray[0];
            } else {
                parentNode = tree.Nodes.Add(Language[control.Parent]);
                parentNode.Name = control.Parent;
            }

            TreeNode childrenNode = null;
            if (control.Name == null) {
                childrenNode = parentNode;
            } else {
                var name = Language[control.Name];
                var childrenArray = parentNode.Nodes.Find(name, false);
                if (childrenArray.Length > 0) {
                    childrenNode = childrenArray[0];
                } else {
                    childrenNode = parentNode.Nodes.Add(name);
                }
            }

            Dictionary[childrenNode] = control;
        }

19 View Source File : TaskBrowserDialog.cs
License : MIT License
Project Creator : dahall

private void LoadChildren(TreeNode p)
		{
			foreach (var item in ((TaskFolder)p.Tag).SubFolders)
			{
				TreeNode n = p.Nodes.Add(item.Path, item.Name, 1, 1);
				n.Tag = item;
				LoadChildren(n);
			}
			if (ShowTasks)
			{
				foreach (var t in ((TaskFolder)p.Tag).Tasks)
				{
					TreeNode tn = p.Nodes.Add(t.Path, t.Name, 2, 2);
					tn.Tag = t;
				}
			}
		}

19 View Source File : TSMMCMockup.cs
License : MIT License
Project Creator : dahall

private static void LoadChildren(TreeNode p)
		{
			foreach (var item in ((TaskFolder)p.Tag).SubFolders)
			{
				var n = p.Nodes.Add(null, item.Name, 3, 3);
				n.Tag = item;
				LoadChildren(n);
			}
		}

19 View Source File : FormMain.cs
License : Microsoft Public License
Project Creator : dandrejvv

private void FillreplacedemblyReferences(IEnumerable<Binary> dependencies, TreeNode treeNode = null)
        {
			foreach (var binary in dependencies)
            {
                if(hideGACreplacedembliesToolStripMenuItem.Checked && binary.IsSystemBinary) continue;
			    string replacedemblyName = showreplacedemblyFullNameToolStripMenuItem.Checked
			                              ? binary.FullName
			                              : binary.DisplayName;
                TreeNode node = new TreeNode(replacedemblyName);
			    node.Tag = binary;

                if (treeNode == null)
                {
                    dependencyTreeView.Nodes.Add(node);
                }
                else
                {
                    if (!FindNodeParent(treeNode, replacedemblyName))
                    {
                        treeNode.Nodes.Add(node);
                    }
                    else
                    {
                        Trace.WriteLine(String.Format("{0} is already a parent of {1}", replacedemblyName, treeNode.Name));
                    }
                }
                if (replacedemblyInformationLoader.Systemreplacedemblies.Where(p => replacedemblyName.StartsWith(p)).Count() == 0)
                {
                    node.Nodes.Add(new TreeNode(Loading));
                }
            }
        }

19 View Source File : Form1.cs
License : MIT License
Project Creator : dathlin

private void Form1_Load(object sender, EventArgs e)
        {
            // 加载配置,如果存在的话
            string saveStr = Settings1.Default.Connects;
            if (!string.IsNullOrEmpty(saveStr))
            {
                ClreplacedNetSettings[] settings = JArray.Parse(saveStr).ToObject<ClreplacedNetSettings[]>();

                TreeNode root = treeView1.Nodes[0];

                foreach (var m in settings)
                {
                    string name = $"{m.IpAddress} [{m.IpPort}]";
                    TreeNode node = new TreeNode(name);
                    node.Tag = new HslCommunication.Enthernet.NetSimplifyClient(
                        m.IpAddress,
                        int.Parse(m.IpPort))
                    {
                        ConnectTimeOut = int.Parse(m.TimeOut),
                        Token = new Guid(m.Token),
                    };
                    node.ToolTipText = m.Guid;

                    root.Nodes.Add(node);
                }

                root.Expand();
                List = new List<ClreplacedNetSettings>(settings);
            }

            if (List == null) List = new List<ClreplacedNetSettings>();
        }

19 View Source File : FormConfiguration.cs
License : MIT License
Project Creator : dathlin

private void FormConfiguration_Load(object sender, EventArgs e)
        {
            Text = UserLocalization.Localization.SettingsText;


            treeView1.AfterSelect += TreeView1_AfterSelect;
            TreeNode treeNodeSystem = treeView1.Nodes[0];
            treeNodeSystem.Text = UserLocalization.Localization.SettingsSystem;

            treeNodeSystem.Nodes.Add("General", UserLocalization.Localization.SettingsGeneral);
            treeNodeSystem.Nodes.Add("Factory", UserLocalization.Localization.SettingsAccountFactory);
            treeNodeSystem.Nodes.Add("Client", UserLocalization.Localization.SettingsTrustClient);
            treeNodeSystem.Nodes.Add("Roles", UserLocalization.Localization.SettingsRolereplacedign);

            treeNodeSystem.Expand();
        }

19 View Source File : FormNodeSetting.cs
License : Apache License 2.0
Project Creator : dathlin

private void modbustcpclientToolStripMenuItem_Click( object sender, EventArgs e )
        {
            // 新增了Modbus-Tcp客户端
            TreeNode node = treeView1.SelectedNode;
            if (node.Tag is NodeClreplaced nodeClreplaced)
            {
                if (nodeClreplaced.NodeType == NodeClreplacedInfo.NodeClreplaced)
                {
                    // 允许添加设备
                    using (NodeSettings.FormModbusTcp formNode = new NodeSettings.FormModbusTcp( new NodeModbusTcpClient( ) ))
                    {
                        if (formNode.ShowDialog( ) == DialogResult.OK)
                        {
                            formNode.ModbusTcpNode.Name = GetUniqueName( node, formNode.ModbusTcpNode.Name );

                            TreeNode nodeNew = new TreeNode( formNode.ModbusTcpNode.Name );
                            nodeNew.ImageKey = "Module_648";
                            nodeNew.SelectedImageKey = "Module_648";
                            nodeNew.Tag = formNode.ModbusTcpNode;
                            node.Nodes.Add( nodeNew );
                            node.Expand( );
                            isNodeSettingsModify = true;
                        }
                    }
                }
            }
        }

19 View Source File : FormNodeSetting.cs
License : Apache License 2.0
Project Creator : dathlin

private void 新增RequestToolStripMenuItem_Click( object sender, EventArgs e )
        {
            // 新增了Modbus-Tcp客户端
            TreeNode node = treeView1.SelectedNode;
            if (node.Tag is DeviceNode deviceNode)
            {
                // 允许添加请求
                using (RequestSettings.FormRequest formNode = new RequestSettings.FormRequest( new DeviceRequest( ) ))
                {
                    if (formNode.ShowDialog( ) == DialogResult.OK)
                    {
                        formNode.DeviceRequest.Name = GetUniqueName( node, formNode.DeviceRequest.Name );

                        TreeNode nodeNew = new TreeNode( formNode.DeviceRequest.Name );
                        nodeNew.ImageKey = "usbcontroller";
                        nodeNew.SelectedImageKey = "usbcontroller";
                        nodeNew.Tag = formNode.DeviceRequest;
                        node.Nodes.Add( nodeNew );
                        node.Expand( );
                        isNodeSettingsModify = true;
                    }
                }
            }
        }

19 View Source File : FormNodeSetting.cs
License : Apache License 2.0
Project Creator : dathlin

private void TreeNodeRender( TreeNode treeNode, XElement element )
        {
            foreach (XElement item in element.Elements( ))
            {
                if (item.Name == "NodeClreplaced")
                {
                    TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                    node.ImageKey = "Clreplaced_489";
                    node.SelectedImageKey = "Clreplaced_489";

                    NodeClreplaced nodeClreplaced = new NodeClreplaced( );
                    nodeClreplaced.LoadByXmlElement( item );
                    node.Tag = nodeClreplaced;
                    treeNode.Nodes.Add( node );

                    TreeNodeRender( node, item );
                }
                else if (item.Name == "DeviceNode")
                {
                    int type = int.Parse( item.Attribute( "DeviceType" ).Value );

                    TreeNode deviceNode = new TreeNode( item.Attribute( "Name" ).Value );
                    if (type == DeviceNode.ModbusTcpClient)
                    {
                        deviceNode.ImageKey = "Module_648";
                        deviceNode.SelectedImageKey = "Module_648";

                        NodeModbusTcpClient modbusNode = new NodeModbusTcpClient( );
                        modbusNode.LoadByXmlElement( item );
                        deviceNode.Tag = modbusNode;
                    }
                    else if (type == DeviceNode.ModbusTcpAlien)
                    {
                        deviceNode.ImageKey = "Module_648";
                        deviceNode.SelectedImageKey = "Module_648";

                        NodeModbusTcpAline modbusAlien = new NodeModbusTcpAline( );
                        modbusAlien.LoadByXmlElement( item );
                        deviceNode.Tag = modbusAlien;
                    }
                    else if (type == DeviceNode.MelsecMcQna3E)
                    {
                        deviceNode.ImageKey = "Enum_582";
                        deviceNode.SelectedImageKey = "Enum_582";

                        NodeMelsecMc node = new NodeMelsecMc( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.Siemens)
                    {
                        deviceNode.ImageKey = "Event_594";
                        deviceNode.SelectedImageKey = "Event_594";

                        NodeSiemens node = new NodeSiemens( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.DeviceNone)
                    {
                        deviceNode.ImageKey = "Method_636";
                        deviceNode.SelectedImageKey = "Method_636";

                        NodeEmpty node = new NodeEmpty( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.Omron)
                    {
                        deviceNode.ImageKey = "HotSpot_10548_color";
                        deviceNode.SelectedImageKey = "HotSpot_10548_color";

                        NodeOmron node = new NodeOmron( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.SimplifyNet)
                    {
                        deviceNode.ImageKey = "FlagRed_16x";
                        deviceNode.SelectedImageKey = "FlagRed_16x";

                        NodeSimplifyNet node = new NodeSimplifyNet( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }


                    treeNode.Nodes.Add( deviceNode );
                    foreach (XElement request in item.Elements( "DeviceRequest" ))
                    {
                        TreeNode nodeRequest = new TreeNode( request.Attribute( "Name" ).Value );
                        nodeRequest.ImageKey = "usbcontroller";
                        nodeRequest.SelectedImageKey = "usbcontroller";

                        DeviceRequest deviceRequest = new DeviceRequest( );
                        deviceRequest.LoadByXmlElement( request );
                        nodeRequest.Tag = deviceRequest;
                        deviceNode.Nodes.Add( nodeRequest );
                    }

                }
                else if (item.Name == "AlienNode")
                {
                    TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                    node.ImageKey = "server_Local_16xLG";
                    node.SelectedImageKey = "server_Local_16xLG";

                    AlienNode nodeClreplaced = new AlienNode( );
                    nodeClreplaced.LoadByXmlElement( item );
                    node.Tag = nodeClreplaced;
                    treeNode.Nodes.Add( node );

                    TreeNodeRender( node, item );
                }
                else if(item.Name == "ModbusServer")
                {
                    TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                    node.ImageKey = "server_Local_16xLG";
                    node.SelectedImageKey = "server_Local_16xLG";

                    NodeModbusServer nodeClreplaced = new NodeModbusServer( );
                    nodeClreplaced.LoadByXmlElement( item );
                    node.Tag = nodeClreplaced;
                    treeNode.Nodes.Add( node );

                    TreeNodeRender( node, item );
                }
            }
        }

19 View Source File : FormBrowseServer.cs
License : GNU Lesser General Public License v3.0
Project Creator : dathlin

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.NodeClreplaced == NodeClreplaced.Object || target.NodeClreplaced == NodeClreplaced.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());
        }

19 View Source File : FormNodeView.cs
License : GNU Lesser General Public License v3.0
Project Creator : dathlin

private void TreeNodeRender( TreeNode treeNode, XElement element )
        {
            foreach (XElement item in element.Elements( ))
            {
                if (item.Name == "NodeClreplaced")
                {
                    TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                    node.ImageKey = "Clreplaced_489";
                    node.SelectedImageKey = "Clreplaced_489";

                    NodeClreplaced nodeClreplaced = new NodeClreplaced( );
                    nodeClreplaced.LoadByXmlElement( item );
                    node.Tag = nodeClreplaced;
                    treeNode.Nodes.Add( node );

                    TreeNodeRender( node, item );
                }
                else if (item.Name == "DeviceNode")
                {
                    int type = int.Parse( item.Attribute( "DeviceType" ).Value );

                    TreeNode deviceNode = new TreeNode( item.Attribute( "Name" ).Value );
                    if (type == DeviceNode.ModbusTcpClient)
                    {
                        deviceNode.ImageKey = "Module_648";
                        deviceNode.SelectedImageKey = "Module_648";

                        NodeModbusTcpClient modbusNode = new NodeModbusTcpClient( );
                        modbusNode.LoadByXmlElement( item );
                        deviceNode.Tag = modbusNode;
                    }
                    else if (type == DeviceNode.ModbusTcpAlien)
                    {
                        deviceNode.ImageKey = "Module_648";
                        deviceNode.SelectedImageKey = "Module_648";

                        NodeModbusTcpAline modbusAlien = new NodeModbusTcpAline( );
                        modbusAlien.LoadByXmlElement( item );
                        deviceNode.Tag = modbusAlien;
                    }
                    else if (type == DeviceNode.MelsecMcQna3E)
                    {
                        deviceNode.ImageKey = "Enum_582";
                        deviceNode.SelectedImageKey = "Enum_582";

                        NodeMelsecMc node = new NodeMelsecMc( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.Siemens)
                    {
                        deviceNode.ImageKey = "Event_594";
                        deviceNode.SelectedImageKey = "Event_594";

                        NodeSiemens node = new NodeSiemens( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.DeviceNone)
                    {
                        deviceNode.ImageKey = "Method_636";
                        deviceNode.SelectedImageKey = "Method_636";

                        NodeEmpty node = new NodeEmpty( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }
                    else if (type == DeviceNode.Omron)
                    {
                        deviceNode.ImageKey = "HotSpot_10548_color";
                        deviceNode.SelectedImageKey = "HotSpot_10548_color";

                        NodeOmron node = new NodeOmron( );
                        node.LoadByXmlElement( item );
                        deviceNode.Tag = node;
                    }

                    treeNode.Nodes.Add( deviceNode );
                    foreach (XElement request in item.Elements( "DeviceRequest" ))
                    {
                        DeviceRequest deviceRequest = new DeviceRequest( );
                        deviceRequest.LoadByXmlElement( request );
                        string parseCode = deviceRequest.PraseRegularCode;
                        if (regularkeyValuePairs.ContainsKey( parseCode ))
                        { 
                            foreach (RegularItemNode regularNodeItem in regularkeyValuePairs[parseCode])
                            {
                                TreeNode treeNodeRegular = new TreeNode( regularNodeItem.Name );
                                treeNodeRegular.ImageKey = "Operator_660";
                                treeNodeRegular.SelectedImageKey = "Operator_660";


                                treeNodeRegular.Tag = regularNodeItem;
                                deviceNode.Nodes.Add( treeNodeRegular );
                            }
                        }
                    }

                }
                else if (item.Name == "ServerNode")
                {
                    int type = int.Parse( item.Attribute( "ServerType" ).Value );

                    if (type == ServerNode.ModbusServer)
                    {
                        TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                        node.ImageKey = "server_Local_16xLG";
                        node.SelectedImageKey = "server_Local_16xLG";

                        NodeModbusServer nodeClreplaced = new NodeModbusServer( );
                        nodeClreplaced.LoadByXmlElement( item );
                        node.Tag = nodeClreplaced;
                        treeNode.Nodes.Add( node );
                    }
                    else if (type == ServerNode.AlienServer)
                    {
                        TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                        node.ImageKey = "server_Local_16xLG";
                        node.SelectedImageKey = "server_Local_16xLG";

                        AlienServerNode nodeClreplaced = new AlienServerNode( );
                        nodeClreplaced.LoadByXmlElement( item );
                        node.Tag = nodeClreplaced;
                        treeNode.Nodes.Add( node );

                        TreeNodeRender( node, item );
                    }
                }
                else if (item.Name == "RegularNode")
                {
                    TreeNode node = new TreeNode( item.Attribute( "Name" ).Value );
                    node.ImageKey = "usbcontroller";
                    node.SelectedImageKey = "usbcontroller";

                    RegularNode nodeClreplaced = new RegularNode( );
                    nodeClreplaced.LoadByXmlElement( item );
                    node.Tag = nodeClreplaced;
                    treeNode.Nodes.Add( node );

                    foreach (XElement regularItemXml in item.Elements( "RegularItemNode" ))
                    {
                        TreeNode treeNodeRegular = new TreeNode( regularItemXml.Attribute( "Name" ).Value );
                        treeNodeRegular.ImageKey = "Operator_660";
                        treeNodeRegular.SelectedImageKey = "Operator_660";

                        RegularItemNode regularItemNode = new RegularItemNode( );
                        regularItemNode.LoadByXmlElement( regularItemXml );
                        treeNodeRegular.Tag = regularItemNode;
                        node.Nodes.Add( treeNodeRegular );
                    }
                }
            }
        }

19 View Source File : FormNodeSetting.cs
License : Apache License 2.0
Project Creator : dathlin

private void 类别clreplacedToolStripMenuItem_Click( object sender, EventArgs e )
        {
            // 新增了类别
            TreeNode node = treeView1.SelectedNode;
            if (node.Tag is NodeClreplaced nodeClreplaced)
            {
                if (nodeClreplaced.NodeType == NodeClreplacedInfo.NodeClreplaced)
                {
                    // 允许添加类别
                    using (NodeSettings.FormNodeClreplaced formNode = new NodeSettings.FormNodeClreplaced( null ))
                    {
                        if (formNode.ShowDialog( ) == DialogResult.OK)
                        {
                            formNode.SelectedNodeClreplaced.Name = GetUniqueName( node, formNode.SelectedNodeClreplaced.Name );

                            TreeNode nodeNew = new TreeNode( formNode.SelectedNodeClreplaced.Name );
                            nodeNew.ImageKey = "Clreplaced_489";
                            nodeNew.SelectedImageKey = "Clreplaced_489";
                            nodeNew.Tag = formNode.SelectedNodeClreplaced;
                            node.Nodes.Add( nodeNew );
                            node.Expand( );
                            isNodeSettingsModify = true;
                        }
                    }
                }
            }
        }

19 View Source File : FormNodeSetting.cs
License : Apache License 2.0
Project Creator : dathlin

private void 欧姆龙plcomronToolStripMenuItem_Click( object sender, EventArgs e )
        {
            // 新增了欧姆龙客户端的设备
            TreeNode node = treeView1.SelectedNode;
            if (node.Tag is NodeClreplaced nodeClreplaced)
            {
                if (nodeClreplaced.NodeType == NodeClreplacedInfo.NodeClreplaced)
                {
                    // 允许添加设备
                    using (NodeSettings.FormOmron formNode = new NodeSettings.FormOmron( null ))
                    {
                        if (formNode.ShowDialog( ) == DialogResult.OK)
                        {
                            formNode.NodeOmron.Name = GetUniqueName( node, formNode.NodeOmron.Name );

                            TreeNode nodeNew = new TreeNode( formNode.NodeOmron.Name );
                            nodeNew.ImageKey = "HotSpot_10548_color";
                            nodeNew.SelectedImageKey = "HotSpot_10548_color";
                            nodeNew.Tag = formNode.NodeOmron;
                            node.Nodes.Add( nodeNew );
                            node.Expand( );
                            isNodeSettingsModify = true;
                        }
                    }
                }
            }
        }

19 View Source File : FormNodeSetting.cs
License : Apache License 2.0
Project Creator : dathlin

private void 空设备toolStripMenuItem_Click( object sender, EventArgs e )
        {
            // 新增了空设备的客户端,用作纯节点使用
            TreeNode node = treeView1.SelectedNode;
            if (node.Tag is NodeClreplaced nodeClreplaced)
            {
                if (nodeClreplaced.NodeType == NodeClreplacedInfo.NodeClreplaced)
                {
                    // 允许添加设备
                    using (NodeSettings.FormEmpty formNode = new NodeSettings.FormEmpty( null ))
                    {
                        if (formNode.ShowDialog( ) == DialogResult.OK)
                        {
                            formNode.NodeEmpty.Name = GetUniqueName( node, formNode.NodeEmpty.Name );

                            TreeNode nodeNew = new TreeNode( formNode.NodeEmpty.Name );
                            nodeNew.ImageKey = "Method_636";
                            nodeNew.SelectedImageKey = "Method_636";
                            nodeNew.Tag = formNode.NodeEmpty;
                            node.Nodes.Add( nodeNew );
                            node.Expand( );
                            isNodeSettingsModify = true;
                        }
                    }
                }
            }

        }

See More Examples