/// <summary> /// Loads available entities to MenuStrip /// </summary> private void entitiesToMenuStrip() { playerToolStripMenuItem.DropDownItems.Clear(); itemsToolStripMenuItem.DropDownItems.Clear(); connectorToolStripMenuItem.DropDownItems.Clear(); foreach (string value in DBReader.selectAllPlayersTableNames(connection, DBName)) { string newValuePlayer = ""; if (value.StartsWith("playersmain")) { newValuePlayer = value.Substring(11, value.Length - 11); } else if (value.StartsWith("playerssub")) { newValuePlayer = value.Substring(10, value.Length - 10); } menuItem = new ToolStripMenuItem { Name = newValuePlayer, Text = newValuePlayer }; playerToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { menuItem }); menuItem.Click += new EventHandler(playerToolStripMenuItem_Click); } foreach (string value in DBReader.selectAllItemsTableNames(connection, DBName)) { string newValueItems = ""; if (value.StartsWith("items")) { newValueItems = value.Substring(5, value.Length - 5); } menuItem = new ToolStripMenuItem { Name = newValueItems, Text = newValueItems }; itemsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { menuItem }); menuItem.Click += new EventHandler(itemsToolStripMenuItem_Click); } foreach (string value in DBReader.selectAllConnectorTableNames(connection, DBName)) { string newValueConnector = ""; if (value.StartsWith("connector")) { newValueConnector = value.Substring(9, value.Length - 9); } menuItem = new ToolStripMenuItem { Name = newValueConnector, Text = newValueConnector }; connectorToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { menuItem }); menuItem.Click += new EventHandler(connectorToolStripMenuItem_Click); } }