private void OnNodeAdded(TreeNode treeNode) { string fullName = treeNode.Tag as string; if (string.IsNullOrEmpty(fullName)) { return; } int galleryId; if (int.TryParse(Path.GetFileNameWithoutExtension(fullName), out galleryId)) { WebBrowserToolTip.SetToolTip(treeNode, galleryId); } }
public TreeNode AddItem(string path, BookmarkNode item) { TreeNode contentNode = new TreeNode(); contentNode.Text = item.Text; contentNode.Tag = new AddBookmarkItemTask(path, item); TreeNodeCollection parentNodes = null; if (path.Contains('/') && !path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) { TreeNode parentNode = AddFolder(path, true); parentNodes = parentNode.Nodes; } else { parentNodes = treeView.Nodes; } ContextMenu contentNodeContextMenu = new ContextMenu(); contentNodeContextMenu.Popup += ItemContentNodeContextMenu_Popup; contentNodeContextMenu.Tag = contentNode; contentNode.ContextMenu = contentNodeContextMenu; parentNodes.Add(contentNode); string[] tokens = item.Value.Split(new char[] { ':' }); int galleryId; if (QueryParser.ParseDetailsSearch(tokens, out galleryId) || QueryParser.ParseDownloadSearch(tokens, out galleryId)) { WebBrowserToolTip.SetToolTip(contentNode, galleryId); } treeView.SelectedNode = contentNode; return(contentNode); }