void HandleItem(object sender) { ToolStripMenuItem item = null; if (sender is ToolStripMenuItem) { item = (ToolStripMenuItem)sender; } if (item != null) { TextNode node = (TextNode)item.Tag; node.Language = (SupportedLanguage)SupportedLanguage.Parse(typeof(SupportedLanguage), item.Text); } }