void modeTool_Click(object sender, EventArgs e) { ToolStripDropDownItem item = sender as ToolStripDropDownItem; if (item != null) { SelectedDevice.SetMode((int)item.Tag); } }