private void FileSystemWatcher_Deleted(object sender, FileSystemEventArgs e) { foreach (TreeNode node in TreeView.Nodes) { if ((node.Tag as string).Equals(e.FullPath, StringComparison.OrdinalIgnoreCase)) { WebBrowserToolTip.RemoveToolTip(node); node.Remove(); break; } } }
private void ItemContentNodeContextMenu_Popup(object sender, EventArgs e) { ContextMenu contextMenu = sender as ContextMenu; TreeNode treeNode = contextMenu.Tag as TreeNode; AddBookmarkItemTask item = treeNode.Tag as AddBookmarkItemTask; contextMenu.MenuItems.Clear(); if (item != null) { string[] tokens = item.Item.Value.Split(new char[] { ':' }); int galleryId; int pageIndex; string query; int tagId; string tagType; string tagName; if (QueryParser.ParseDetailsSearch(tokens, out galleryId)) { contextMenu.MenuItems.Add(new MenuItem("&Show Details", (sender2, e2) => { SearchHandler.ParseAndExecuteSearchText(item.Item.Value); })); contextMenu.MenuItems.Add("-"); contextMenu.MenuItems.Add(new MenuItem("&Read", (sender2, e2) => { CacheFileSystem.OpenFirstCachedPage(galleryId); })); contextMenu.MenuItems.Add(new MenuItem("&Browse", (sender2, e2) => { CacheFileSystem.SelectFirstCachedPage(galleryId); })); contextMenu.MenuItems.Add(new MenuItem("&Show in Explorer", (sender2, e2) => { CacheFileSystem.SelectPagesFolder(galleryId); })); } else if (QueryParser.ParseDownloadSearch(tokens, out galleryId)) { contextMenu.MenuItems.Add(new MenuItem("&Show Download", (sender2, e2) => { SearchHandler.ParseAndExecuteSearchText(item.Item.Value); })); contextMenu.MenuItems.Add("-"); contextMenu.MenuItems.Add(new MenuItem("&Read", (sender2, e2) => { CacheFileSystem.OpenFirstCachedPage(galleryId); })); contextMenu.MenuItems.Add(new MenuItem("&Browse", (sender2, e2) => { CacheFileSystem.SelectFirstCachedPage(galleryId); })); contextMenu.MenuItems.Add(new MenuItem("&Show in Explorer", (sender2, e2) => { CacheFileSystem.SelectPagesFolder(galleryId); })); } else if (QueryParser.ParseRecentSearch(tokens, out pageIndex)) { contextMenu.MenuItems.Add(new MenuItem("&Recent Search", (sender2, e2) => { SearchHandler.ParseAndExecuteSearchText(item.Item.Value); })); } else if (QueryParser.ParseQuerySearch(tokens, out query, out pageIndex)) { contextMenu.MenuItems.Add(new MenuItem("&Query Search", (sender2, e2) => { SearchHandler.ParseAndExecuteSearchText(item.Item.Value); })); } else if (QueryParser.ParseTaggedSearch(tokens, out tagId, out tagType, out tagName, out pageIndex)) { contextMenu.MenuItems.Add(new MenuItem("&Tagged Search", (sender2, e2) => { SearchHandler.ParseAndExecuteSearchText(item.Item.Value); })); } else if (QueryParser.ParseLibrarySearch(tokens, out pageIndex)) { contextMenu.MenuItems.Add(new MenuItem("&Show in Library", (sender2, e2) => { SearchHandler.ParseAndExecuteSearchText(item.Item.Value); })); } contextMenu.MenuItems.Add("-"); contextMenu.MenuItems.Add(new MenuItem("&Remove bookmark", (sender2, e2) => { WebBrowserToolTip.RemoveToolTip(treeNode); treeNode.Remove(); BookmarksModel.RemoveBookmark(item.Path); }) { Name = "remove" }); // TODO: "move to..." command (to change the bookmark path) } }