public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { List <ToolStripItem> items = new List <ToolStripItem>(); if (owner is WatchPad) { WatchPad pad = (WatchPad)owner; if (pad.WatchList.SelectedNode == null) { return(items.ToArray()); } var node = pad.WatchList.SelectedNode.Node; while (node.Parent != null && node.Parent.Parent != null) { node = node.Parent; } if (!(node is TextNode)) { return(items.ToArray()); } foreach (string item in SupportedLanguage.GetNames(typeof(SupportedLanguage))) { items.Add(MakeItem(item, item, node as TextNode, (sender, e) => HandleItem(sender))); } } return(items.ToArray()); }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { List <ToolStripItem> items = new List <ToolStripItem>(); if (owner is WatchPad) { WatchPad pad = (WatchPad)owner; TreeViewVarNode node = ((TreeViewAdv)pad.Control).SelectedNode as TreeViewVarNode; if (node == null) { return(items.ToArray()); } while (node.Parent != ((TreeViewAdv)pad.Control).Root) { node = node.Parent as TreeViewVarNode; } if (!(node.Content is TextNode)) { return(items.ToArray()); } foreach (string item in SupportedLanguage.GetNames(typeof(SupportedLanguage))) { items.Add(MakeItem(item, item, node.Content as TextNode, (sender, e) => HandleItem(sender))); } } return(items.ToArray()); }